Vue.js 错误:'Missing semicolon' 在 D:\Work\HBuilder\diyijichu\pages\index\index.vue (103:20)
在 103 行末尾加上分号,即:
changeSlide(index) {
this.currentSlide = index;
if (index % 3 === 0) {
this.swipers = this.swipers1;
} else {
this.swipers = this.swipers2;
}
};
这是因为在 JavaScript 中,函数声明需要以分号结束。在 Vue.js 中,模板中的代码也是 JavaScript 代码,因此也需要遵循 JavaScript 的语法规则。
原文地址: https://www.cveoy.top/t/topic/lHXr 著作权归作者所有。请勿转载和采集!