WATCH
- watch变量变化太快,只能监听到最后一次,可以sleep实现快速监听;
- watch默认第一次不监听,需要加参数,immediate:true
Components
- 重复嵌套子组件:子组件1-》子组件2-》子组件1,每次导入需要import 不同的名称
STYLES
- 不加require动态绑定会解析不到(vue_admin_template框架里)
:src="require(`@/icons/monitor/${list.stat_type}.png`)"
ElementUI
- element ui 自定义上传,解决进度条问题
let form = new FormData();
form.append("file", uploader.file);
axios .post(url,form, {
headers: { "Content-Type": "multipart/form-data" },
onUploadProgress: progressEvent => {
let percent=(progressEvent.loaded / progressEvent.total * 100) | 0
uploader.onProgress({percent:percent})
}
}).then((res)=>{
uploader.onSuccess()
})
.catch((err)=>{
uploader.onError()
})