1、报错:the "this" keyword is disallowed outside of a class body
解决方案:改tslint.json配置
“no-invalid-this”: true
2、报错:Cannot find module "@/assets/scss/variables.scss" (vetur)
解决方案:
3、一直有波浪线:
解决方案:
是因为AppState的类型没有详细到sideBar下的opened类型级别
=》
4、
5、
解决:
6、
解决:
7、
(this.$refs[formName] as ElForm).validate((valid: boolean) => {
if (valid) {
console.log("submit!");
this.$emit("submit", this.form);
} else {
console.log("error submit!!");
return false;
}
});
8、
9、导入图片
export default class Application extends Vue {
private list = [
{ id:‘1’, img: require(`${“@/assets/images/ob.jpg”}`),txt:‘test1’},
{ id:‘2’, img: require(`${“@/assets/images/oc.jpg”}`),txt:‘test2’}
]
}
10、iframe.contentWindow
波浪线报错如下:
Property 'contentWindow' does not exist on type 'Vue | Element | Vue[] | Element[]'.Property 'contentWindow' does not exist on type 'Element'.Vetur(2339)
解决:
11、
在.vue文件里 "import path from 'path' ’" 报错 Cannot find module 'path'.
解决:在tsconfig.json的type项添加"node"即可。
"types": [
"node",
],
12、
Cannot find module '@/assets/images/logo.png'.Vetur
解决:在shims-vue.d.ts文件里,加入:
declare module '*.png' {
export const png: any
}
13、
el.enlarge = false 报错:
Property 'enlarge' does not exist on type 'HTMLElement'. typescripte
解决:
(el as any).enlarge = false