左边拖拽到右边数组,左边拖拽到右边,修改右边所有数组中classs =false,拖动当前数据为classs =true,当左边两条相同拖拽到右边时,右边这两条数据的classs都为true了。
return{ design :[], icon_list:[{ type:'image', icon:'fa fa-picture-o', name:'图片', content:{ image: '' }, classs:false, i:'' }, { type:'text', icon:'fa fa-font', name:'富文本', content:{}, classs:false, i:'' }, { type:'par', icon:'fa fa-bold', name:'参数', content:{ trace:[] }, classs:false, i:'' }] } }
{{item.name}}
{{item.type+index}}`请输入代码` editSlice(it,index){ var _this = this; for (var i in this.slices) { _this.slices[i].classs = false; _this.slices[i].i = i; console.log('classs',_this.slices[i].classs) }; console.log('222',this.slices); console.log('i',index) it.classs = true; //this.$set(it, 'classs', true); //this.design = item; console.log('222',this.slices); }, log: function (e){ this.editSlice(this.slices[e.added.newIndex],e.added.newIndex); }
Processed with deep copy