elementui修改源码方法,及配置、自定义格式化表格

https://blog.csdn.net/weixin_43864045/article/details/85098254

 

表格自动适应出现滚动条

<div class="right_table">
                        <nk-table
                            :showPage="false"
                            height="100%"
                            :page="page"
                            :data="treerightData"
                            :columns="treerightcolumns"
                            :rowselect="rowselect"
                            @rowselectChange="treerightselectChange"
                        ></nk-table>
                    </div>

.right_table{
    width:100%;
    flex:1;height:100%;border:1px solid #ccc;    box-sizing: border-box;
}
.right_table div{height: 100% !important;}

二,tree默认选中和展开到指定节点

this.$refs.tree.setCurrentKey("6336547422568504856");
this.$refs.tree.defaultExpandedKeys=["6336547422568504856"];

三、

//如果prop是warningStatus,则格式为红点,否则显示原来的值
scope.row //返回当前行当值
scope.$index //返回当前行下标
scope.row[items.prop] //返回当前行值

<el-table :data="tableData" border ref="eltable">
          <el-table-column
            v-for="(items, i) in exitCoumn"
            :key="i"
            :prop="items.prop"
            :label="items.label"
            :align="items.align"
          >
            <template #default="scope">
              <div
                v-if="items.prop === 'warningStatus'"
                style="width: 10px; height: 10px; background: red"
              ></div>
              <div v-else>{{ scope.row[items.prop] }}</div>
            </template>
          </el-table-column>
          <el-table-column label="操作" align="center">
            <el-button type="text" size="small" @click="dialogVisible = true"
              >编辑</el-button
            >
          </el-table-column>
        </el-table>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值