1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| <template> <div> <el-button @click="$refs.editable.insert()">新增</el-button> <el-button @click="$refs.editable.removeSelecteds()">删除选中</el-button>
<elx-editable ref="editable" :data.sync="tableData"> <elx-editable-column type="selection" width="55"></elx-editable-column> <elx-editable-column type="index" width="55"></elx-editable-column> <elx-editable-column prop="name" label="只读"></elx-editable-column> <elx-editable-column prop="sex" label="下拉" :edit-render="{name: 'ElSelect', options: sexList}"></elx-editable-column> <elx-editable-column prop="num" label="数值" :edit-render="{name: 'ElInputNumber'}"></elx-editable-column> <elx-editable-column prop="date" label="日期" :edit-render="{name: 'ElDatePicker', props: {type: 'date', format: 'yyyy-MM-dd'}}"></elx-editable-column> <elx-editable-column prop="flag" label="开关" :edit-render="{name: 'ElSwitch', type: 'visible'}"></elx-editable-column> <elx-editable-column prop="remark" label="文本" :edit-render="{name: 'ElInput'}"></elx-editable-column> </elx-editable> </div> </template>
<script> export default { data () { return { tableData: [{ date: 1551322088449, name: '小徐', sex: '1', num: '26', flag: false, remark: '备注' }], sexList: [ { 'label': '男', 'value': '1' }, { 'label': '女', 'value': '0' } ] } } } </script>
|