element的表格中scope中的东西

主要是这几个东西:
在这里插入图片描述
第一个:$index中存着当前行,在表格的列表中的索引值,
第二个:column本列的数据
第三个:row本行的数据
具体的应用:

  //添加套餐的菜品
    addTableItem(index) {
    
    
      console.log(this.goodInfoList.dishesFormatTypeList[index].dishesFormatList)
      let obj = {
    
    
                title:'',
                price:'',
                saleNumber:'',
                total:''
              };
       let arr = this.goodInfoList.dishesFormatTypeList[index].dishesFormatList;
       this.$set(arr, arr.length, obj);    //arr是取得这个列表的地址,arr.length取得要添加元素的索引,obj是要添加的位置
 
    },
     // 删除套餐分组的表格数据
    itemDel(scope,index) {
    
    
      this.$delete(this.goodInfoList.dishesFormatTypeList[index].dishesFormatList, scope.$index);
      //删除的话,两个参数,这个列表的地址,要删除元素的索引
    },

猜你喜欢

转载自blog.csdn.net/weixin_42349568/article/details/114501502
今日推荐