zoukankan      html  css  js  c++  java
  • iview的table:自定义table表格中列头的标题和点击事件(renderHeader)

     <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('第一行值为空,不能复制!')
            }
          },
  • 相关阅读:
    石子归并
    【性能测试工具】- ApacheBench
    如何提问
    HTTP 0.9 / 1.0 / 1.1
    【NO.3-1】Jmeter
    【有意思的BUG】未名
    【FlashPlayer】-Debug版本-开发人员推荐
    【NO.1】Jmeter-安装JDK- 配置Jmeter运行的环境
    【IP限制】验证是否限制了境外IP访问权限
    【有意思的BUG】视频连接超时
  • 原文地址:https://www.cnblogs.com/wssdx/p/13268537.html
Copyright © 2011-2022 走看看