-
image.png
- 源码
<template> <div> <el-button size="mini" @click="handleAdd()" type="primary">Add</el-button> <el-table ref="mytable" :data="table_data" style="width: 100%" @selection-change="handleSelectionChange" > <el-table-column v-if="radio" type="index" width="50"></el-table-column> <el-table-column v-if="selection" type="selection" width="55"></el-table-column> <el-table-column align="center" v-for="(item,index,key) in table_columns" :item="item" :key="key" :index="index" :label="item.label" > <template slot-scope="scope"> <el-input v-if=" scope.row.edit" size="small" v-model="scope.row[item.prop]" :placeholder="'请输入'+item.label" ></el-input> <span v-if=" !scope.row.edit">{{scope.row[item.prop]}}</span> </template> </el-table-column> <el-table-column label="操作" align="center"> <template slot-scope="scope"> <!-- 全局控制的编辑 --> <div v-if="is_edit&&scope.row.add==undefined" style="display: inline-block;"> <!-- 编辑 --> <el-button size="mini" v-if="!scope.row.edit" @click