为了账号安全,请及时绑定邮箱和手机立即绑定

我在vue中的v-for里绑定事件报错?

我在vue中的v-for里绑定事件报错?

守着一只汪 2018-11-05 12:18:16
我在v-for里面循环生成route-link,想给他绑定一个事件,结果报错说事件未定义,下面是我的代码    <ul class="card-list">      <li v-for="(url, index) in urls">        <router-link class="linkTo" :to="'/Page' + (index + 1)">          <img @click="total(index)" class="cardWidth" :src="url" alt="">        </router-link>      </li>    </ul>        method: {      total: function (index) {        console.log(index)      }    }        报错信息:Property or method "total" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option. Uncaught TypeError: _vm.total is not a function
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 1345 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号