猿问

vue.js methods 调用函数 参数 not defined

<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


MYYA
浏览 2761回答 1
1回答

牛魔王的故事

vue2?index-and-key-移除改成类似v-for="(item,&nbsp;index)&nbsp;in&nbsp;items"这种样子的吧
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答