iview 自定义table 表格

export const tableTh = (dataLength, monthnum, el) => {
//th配置字典
  returnData = [
    {
      keyId: "13",
      tableColumns: [
 
        {
          title: "工业增加值增速",
          align: "center",
          children: [
            {
              title: "地  区",
              key: "region",
              align: "left"
            },
            {
              title: "累计(%)",
              fatherTitle: "工业增加值增速",
              unit: "%",
              key: "added_lj",
              field: "added_lj",
              align: "right",
              render: (h, params) => {
                return h(
                  "div",
                  {
                    on: {
                      click: () => {
                        if (params.row["added_lj"]) {
                          el.getColumnMethod(params, changeYearMonth, el);
                        }
                      }
                    }
                  },
                // 所要展示内容
                  params.row["added_lj"]
                    ? parseFloat(params.row["added_lj"]).toFixed(1)
                    : "-"
                );
              }
            },
          ]
        },
      ]
    },
  ];
  return returnData;
};

使用页面引用方式

methods: {
  getColumnMethod(params, changeYearMonth, el) {}
}
//调用
import {
  tableTh,
  addedkey12Formdata,
  addedkey14Formdata,
} from "@/utils/monthdatatableth";

this.tableColumns = tableTh(reslength, self.monthnum, self)
          .filter(item => item.keyId === self.keyId)
          .map(item => item.tableColumns)[0];
//vue  


组件使用














你可能感兴趣的:(iview 自定义table 表格)