vue中列表绑定出现错误提示

错误提示:
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}
        ]
      }
    }
阅读 9.7k
2 个回答

clipboard.png

应该是item.active

推荐问题