[Vue warn]: Property or method “c” is not defined on the instance but referenced during render. Make sure that this prop
[Vue warn]:属性或方法“c”没有在实例中定义,而是在呈现时被引用。确保这个道具
错误就是数据没有绑定
<div v-for="tao in courses" :key="tao" :class="{active:selectedCourse === c }" @click="selectedCourse = c">
{{ tao }}
</div>
下面是Vue代码
const app = new Vue({
el:'#app',
data(){
return{
title:"hello vue",
course: '',
selectedCourse:'',
courses: ['123','234']
}
}
其实只需要把active部分的c改成tao就解决了