Code
export default class Random extends Vue {
// data
public nowIndex: number = -1;
public swiperOption: Object = {
slidesPerView: 6,
slidesPerGroup: 6,
loopFillGroupWithBlank: true,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev"
},
on: {
click: function(this: any): void {
nowIndex = this.clickedSlide.dataset.key;
}
}
};
}
Question:
Click event's this
direct to the Swiper
element , I need it to get a key to tell me which one is being clicked , and I want save this key in vue data ---- nowIndex , but I had a error says "Cannot find name 'nowIndex'"
What I do:
I try defined a public value vue
direct to this
in the class , but it does not work , the error also says "Cannot find name 'vue'"
End: I hope someone can see this and give me a way out , think you very much TAT .