vue element 动态表格

<el-table-column :label="item.propName" :property="item.prop" v-for="item in tableColumnList" :key="item.prop" align="center">
              <template slot-scope="scope">
                    <span>{{scope.row[scope.column.property]}}</span>
                  
              </template>
          </el-table-column>
 
 tableColumnList: [{prop: 'id', propName: '编号'},
                        {prop: 'name', propName: '名字'},
                        {prop: 'age', propName: '保质期'},
                        {prop: 'remark', propName: '特点'}],
       dataList: [{'id': '100001','name': '小红萝卜','age': '2年','remark': '适合油炸','country': '中国','address': '广东省深圳市'},
                 {'id': '100002','name': '萝卜妹','age': '2年','remark': '适合水煮','country': '美国','address': '硅谷'},
                 {'id': '100003','name': '胖萝卜头','age': '1年','remark': '适合玩儿','country': '泰国','address': '清迈'},
                 {'id': '100004','name': '萝卜酱','age': '4年','remark': '适合吃火锅','country': '韩国','address': '首尔'}],
 
随意记录一下
原文地址:https://www.cnblogs.com/wqing/p/13652536.html