错误提示:Property or method "item" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option.
我的模板文件:
<template>
<div class="qui-nav nav-type-1">
<a v-for="(item,index) in items" v-bind:class="[commonClass,items.active?activeClass:''] v-on:click='navClickEvent(items,index)'>
<span class="nav-txt" >{{item.text}}</span>
</a>
</div>
</template>
js代码:
export default{
data:function () {
return {
commonClass:'nav-item',
activeClass:'active',
items:[
{text:'Index',active:true},
{text:'List',active:false},
{text:'About',active:false},
{text:'Join us',active:false}
]
}
}
应该是
item.active