<el-table v-loading="loading" :data="userInfoList" @selection-change="handleSelectionChange">
<el-table-column label="指標項" align="center" prop="name"/>
<el-table-column label="數(shù)量" align="center" prop="num">
<template #default="scope">
<span v-show="scope.row.id !== editId">{{ scope.row.num }}</span>
<el-input
v-show="scope.row.id === editId"
v-model="scope.row.num"
></el-input>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate2(scope.row)" v-show="scope.row.id !== editId">
表格修改
</el-button>
<el-button link type="primary" icon="Edit" @click="submitForm2(scope.row)" v-show="scope.row.id === editId">
完成
</el-button>
</template>
</el-table-column>
</el-table>
/** 修改按鈕操作 */
function handleUpdate2(row) {
editId.value = row.id;
}
/** 修改完成提交按鈕 */
function submitForm2(row) {
editId.value = 0;
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者