安装依赖
npm install af-table-column
main.js 中引入依赖,
import Vue from 'vue'
import ElementUI from 'element-ui'
//需要按需引入,先引入vue并引入element-ui
import AFTableColumn from 'af-table-column'
Vue.use(AFTableColumn)
demo样式:
<template><el-table :data="data"><af-table-column label="列1" prop="field1"></af-table-column><af-table-column label="列2" prop="field2"></af-table-column><!--也支持简单的自定义内容--><af-table-column label="列3"><template slot-scope="scope"><div>自定义显示值31: {{ scope.row.field31 }}</div><div>自定义显示值32: {{ scope.row.field32 }}</div></template></af-table-column>//也支持element-ui原有的el-table-column<el-table-column label="操作"><template slot-scope="scope"><el-button @click="removeItem">删除</el-button></template></el-table-column >//af-table-column 和af-table-column 可以同时在一个表格中使用</el-table>
</template>