vue表格导出

inportexcel: function() { //兼容ie10哦!
require.ensure([], () => {        
const { export_json_to_excel } = require('../../vendor/Export2Excel');  //引入文件      
const tHeader = ['用户名', '姓名', '部门', '职位', '邮箱', '充值']; //将对应的属性名转换成中文
// const tHeader = [];
        
const filterVal = ['userName', 'realName', 'department', 'position', 'email', 'money'];//table表格中对应的属性名         
const list = this.sels;        
const data = this.formatJson(filterVal, list);        
export_json_to_excel(tHeader, data, '列表excel');      
})

}

formatJson(filterVal, jsonData) {    
   return jsonData.map(v => filterVal.map(j => v[j]))   
  },

相关文件下载地址:https://files.cnblogs.com/files/wangyunhui/vendor.rar

posted @ 2017-08-16 10:37  neo_o  阅读(227)  评论(0)    收藏  举报

愿你的生活只有诗和远方