1、npm run dev 报错 'vue-cli-service' 不是内部或外部命令,也不是可运行的程序
npm install
2、运行
npm run dev
3、提示框
this.$message.error('错误提示框');
this.$message.success("成功提示框");
this.$confirm('确定删除该企业吗 ?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}) .then(() => {
//操作
}).catch(() => {})
4、vue-elemenu-ui分页英文问题
src→main.js 文件里面的
import locale from 'element-ui/lib/locale/lang/en'
修改为
import locale from 'element-ui/lib/locale/lang/zh-CN'
5、element ui 对话框el-dialog关闭事件
6、element-ui Form表单验证规则全解
7、vue+elementui进阶之路-el-table中显示图片
table中显示图片当需要遍历图片时,不能直接使用prop绑定值
一张图片
<el-table-column label="头像">
<template slot-scope="scope">
<img :src="scope.row.img" width="40" height="40" class="head_pic"/>
</template>
</el-table-column>
多张图片
<el-table-column prop="pictures" label="描述图片">
<template scope="scope">
<img v-for="item in scope.row.pictures" :src="item" width="40" height="40" class="head_pic"/>
</template>
</el-table-column>
8、前端导出
// 安装xlsx filesaver
npm install xlsx --save
npm install file-saver --save
exportExc(){
let fix = document.querySelector('.el-table__fixed');
let wb;
if(fix){ //判断要导出的节点中是否有fixed的表格,如果有,转换excel时先将该dom移除,然后append回去
wb = XLSX.utils.table_to_book(document.querySelector('#table').removeChild(fix));
document.querySelector('#table').appendChild(fix);
}else{
wb = XLSX.utils.table_to_book(document.querySelector('#table'));
}
let wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' })
try {
FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), '抄表功能.xlsx')
} catch (e) {
if (typeof console !== 'undefined') console.log(e, wbout)
}
return wbout
},