對Vue table 動(dòng)態(tài)表格td可編輯的方法詳解
項(xiàng)目中需求用到可編輯表格
下圖這種 ↓


element UI 組件table表格中 增加template 模版
翻入input
根據(jù)業(yè)務(wù)邏輯增加全局變量 isEdit 是否變化。
<el-table-column
label="名稱"
width="140">
<template scope="scope">
<el-input v-if="scope.row.isEdit && scope.row.status === 0" v-model="scope.row.name" ></el-input>
<label v-if="scope.row.status === 1" class="indisable">{{scope.row.name +'(已禁用)' || '--'}}</label>
<label v-if="!scope.row.isEdit && scope.row.status === 0">{{scope.row.name || '--'}}</label>
</template>
</el-table-column>
編輯函數(shù) :@lick="edit"
edit (val) {
this.initUpdateVal = val.name
val.isEdit = true
},
以上這篇對Vue table 動(dòng)態(tài)表格td可編輯的方法詳解就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
在vue中使用vue-echarts-v3的實(shí)例代碼
這篇文章主要介紹了在vue中使用vue-echarts-v3的實(shí)例代碼,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2018-09-09
vue.js中關(guān)于點(diǎn)擊事件方法的使用(click)
這篇文章主要介紹了vue.js中關(guān)于點(diǎn)擊事件方法的使用(click),具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-08-08
Vue 解決通過this.$refs來獲取DOM或者組件報(bào)錯(cuò)問題
這篇文章主要介紹了Vue 解決通過this.$refs來獲取DOM或者組件報(bào)錯(cuò)問題,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-07-07
Vuejs 組件——props數(shù)據(jù)傳遞的實(shí)例代碼
本篇文章主要介紹了Vuejs 組件——props數(shù)據(jù)傳遞的實(shí)例代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下。2017-03-03

