导出表格例子
// 导出表格excel
exportExcel() {
var wb = XLSX.utils.table_to_book(document.querySelector('#out-table')) //out-table是表格id
/* get binary string as output */
var wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: true,
type: 'array'
})
try {
FileSaver.saveAs(new Blob([wbout], {
type: 'application/octet-stream'
}), 'sheetjs.xlsx')
} catch(e) {
if(typeof console !== 'undefined') console.log(e, wbout)
}
return wbout
}
刷新页面例子
refresh() { //刷新
this.$nextTick(() => {
this.$router.replace({
path: '/redirect' + this.$route.path
})
})
}