vue中动态循环el-table的列

<template>
  <div class="hello">
    <EncapTable ref="items" :Data="Data"></EncapTable>
  </div>
</template>

<script>
import EncapTable from "./EncapTable";
export default {
  name: "HelloWorld",
  components: {
    // 注册组件
    EncapTable
  },
  data() {
    return {
      Data: {
        tableData: [
          // 表单数据
          {
            date: "2016-05-02",
            name: "王小虎",
            address: "上海市普陀区金沙江路 1518 弄"
          },
          {
            date: "2016-05-04",
            name: "王小虎",
            address: "上海市普陀区金沙江路 1517 弄"
          },
          {
            date: "2016-05-01",
            name: "王小虎",
            address: "上海市普陀区金沙江路 1519 弄"
          },
          {
            date: "2016-05-03",
            name: "王小虎",
            address: "上海市普陀区金沙江路 1516 弄"
          }
        ],
        tableTitle: [
          // 用于动态循环表头
          {
            prop: "date",
            label: "日期"
          },
          {
            prop: "name",
            label: "姓名"
          },
          {
            prop: "address",
            label: "地址"
          }
        ],
        // 一页显示多少条
        pageSize: 10,
        // 是否显示编辑和删除
        showEditAndDelete: true
      }
    };
  },
  mounted() {}
};
</script>

<style scoped></style>

 

posted @ 2021-04-30 10:59  yw3692582  阅读(2868)  评论(0编辑  收藏  举报