<Table
           class="table"
           :columns="columns1"
           :data="tableData"
           highlight-row
           :max-height="500"
           border
           @on-selection-change="onSelectionChange"
           @on-row-click="onRowClick"
    >
      <!-- 重量 -->
      <template slot-scope="{ row, index }" slot="weight">
        <Input v-model="tableData[index].weight" placeholder="请输入..." class="form-width" />
      </template>
    </Table>
 
 
columns1: [
          {
            title: '重量',
            slot: 'weight',
            align: 'center',
            key: 'weight',
            renderHeader: (h, params)  => {
              return h('div',[
                h('span', {}, '重量'),
                h('Icon', {
                  props: {
                    type: 'ios-copy-outline',
                    size: '18'
                  },
                  on: {
                    'click': (event) => {
                      this.weightCopy(event);
                    }
                  }
                })
              ])
            },
          }
        ],
 
  // 重量值拷贝功能
      weightCopy(e){
        if (this.tableData.length && this.tableData[0].weight) {
          this.tableData.map((item, index) => {
            this.tableData.splice(index, 1, {
              ...item,
              weight: this.tableData[0].weight
            })
          })
        } else {
          this.$Message.warning('第一行值为空,不能复制!')
        }
      },

相关文章:

  • 2022-12-23
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-22
  • 2022-12-23
相关资源
相似解决方案