亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

vue.js methods 調用函數 參數 not defined

vue.js methods 調用函數 參數 not defined

MYYA 2018-10-13 10:06:51
<li v-for='item in title' v-text="item.name" :class="{aside:item.iscur}" v-on:click="setCur($index)">{{ item.name }}</li>data:{                    title:[                         {name:'買入',id:'0',iscur:true},                         {name:'賣出',id:'1',iscur:false},                         {name:'Push',id:'2',iscur:false},                         {name:'抵押',id:'3',iscur:false},                         {name:'交易',id:'4',iscur:false},                     ]}                          methods:{                    setCur: function (index) {                         index.currentTarget;                        this.title.map(function (v,i) {                             i==index? v.iscur=true: v.iscur=false;                         });                     }                 }                                                         vue.js methods 調用函數 $index is not defined
查看完整描述

1 回答

?
牛魔王的故事

TA貢獻1830條經驗 獲得超3個贊

vue2?
index-and-key-移除

改成類似

v-for="(item, index) in items"

這種樣子的吧


查看完整回答
反對 回復 2018-11-03
  • 1 回答
  • 0 關注
  • 2777 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號