/* 이미지 슬라이드 버튼 자바스크립트 작성시 */
import { LightningElement,wire,track, api } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import Get_Image from '@salesforce/apex/GetImageFileurl.Get_Image'; // apex 클래스 가져오는 것
export default class NearMarketImage_Retailstore extends LightningElement {
@api recordId; // apex클래스에서 작성된 api를 호출
imageurl; doc; non_doc; imagelist;
currenturl; currentdes ; index
non=false;
@wire(Get_Image, { recordId: '$recordId' }) // apex 클래스에서 가져오기
GetWPSELLFunction(result){ // 함수 선언하고 result를 담아준다.
if(result.data){ // result와 data를 조건으로 선언
console.log(result.data) // console.log로 확인시 여러값들을 확인할 수 있다.
this.imagelist = result.data; // imagelist라는 변수에 현재 데이터를 담는다.
console.log(this.imagelist) // 콘솔로그로 확인시 아직까진 현재데이터를 확인 가능
// 내가 원하는 값을 가져오고 싶을 때 방법
this.currenturl = result.data[0].ContentUrl // result.data의 [0]첫번째순서의 ContentUrl이라는 값을 가져오겠다 라는 의미
this.currentdes = result.data[0].ContentDocument.Description // result.data의 [0]첫번째순서의 ContentDocument의 Description이라는 값을 가져오겠다 라는 의미
console.log(this.currenturl) // 콘솔로그시 해당 값이 뜨는지 확인
console.log(this.currentdes) // 콘솔로그시 해당 값이 뜨는지 확인
this.index = 0 // 순서를 첫번째부터 하겠다는 뜻
}
handleNextBtn(event){ // 다음버튼 클릭 이벤트 실행시 다음 값들을 실행하겠다는 뜻
this.index+=1 // 다음순서를 나타냄
console.log(this.index) // 콘솔로그 확인시 다음 값인 1이 확인됨
this.currenturl = this.imagelist[this.index].ContentUrl // 값이담긴 this.imagelist의 [this.index]다음 순서의 ContentUrl이라는 값
this.currentdes = this.imagelist[this.index].ContentDocument.Description // 값이담긴 this.imagelist의 [this.index]다음 순서의 ContentUrl이라는 값
console.log(this.currenturl)
console.log(this.currentdes)
}
handlePreviousBtn(event){
this.index-=1
this.currenturl = this.imagelist[this.index].ContentUrl
this.currentdes = this.imagelist[this.index].ContentDocument.Description
console.log(this.currenturl)
console.log(this.currentdes)
}
}