一、在template先写入
<el-table :data="tableData" style="width: 100%"> <el-table-column align="center" label="id" prop="id" width="180" /> <el-table-column align="center" label="名称" prop="name" width="180"> <template slot-scope="scope"> <el-input v-model="scope.row.parentName" placeholder="请输入内容" /> </template> </el-table-column> <el-table-column align="center" label="库存" prop="name" width="180"> <template slot-scope="scope"> <el-input v-model="scope.row.parentName" placeholder="请输入内容" /> </template> </el-table-column> <el-table-column align="center" label="限购"> <template slot-scope="scope"> <el-input v-model="scope.row.typeName" placeholder="请输入内容" /> </template> </el-table-column> <el-table-column align="center" label="划线价"> <template slot-scope="scope"> <el-input v-model="scope.row.typeName" placeholder="请输入内容" /> </template> </el-table-column> <el-table-column align="center" label="售价"> <template slot-scope="scope"> <el-input v-model="scope.row.typeName" placeholder="请输入内容" /> </template> </el-table-column> <el-table-column align="center" label="结算价"> <template slot-scope="scope"> <el-input v-model="scope.row.typeName" placeholder="请输入内容" /> </template> </el-table-column> <el-table-column align="center" label="操作"> <template slot-scope="scope"> <el-popover :ref="`popover-${scope.$index}`" placement="left" trigger="click" width="260" > <p>确定删除改规格吗?</p> <div style="text-align: center"> <el-button size="mini" @click="quxiao(scope)">取消</el-button> <el-button size="mini" type="danger" @click="deleteRow(scope, tableData)" > 确定 </el-button> </div> <div style="cursor: pointer; color: #3054eb" slot="reference"> 删除 </div> </el-popover> </template> </el-table-column> </el-table>
二、js
quxiao(ee) { ee._self.$refs[`popover-${ee.$index}`].doClose() }, closePopover(ee) { this.$confirm(`确定要将${ee.row.name}审核通过吗?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning', }) .then(async () => { let cc = { id: parseInt(ee.row.id), distributionStatus: 1, } let zz = await toExamine(cc) if (zz.code == 200) { await this.fetchData() this.$message({ type: 'success', message: '审核成功!', }) } }) .catch(() => { this.$message({ type: 'info', message: '您取消了审核', }) }) console.log(ee.row) ee._self.$refs[`popover-${ee.$index}`].doClose() },