第一个问题:
import Header from '@/components/Header.vue'
我使用如上引入一个组件,页面都有显示了,编译也没有报错,能正常运行,但是就是在vscode
中有个红色的波浪线Cannot find module '@/components/Header.vue'.
,请教大佬tslint
该怎么设置才能将这个波浪线掉。
第二个问题:
之前我将一些变量定义在export default
之外,原因是不涉及到页面变化我就喜欢定义在外面而不是data
中,(因为小程序写在data
中而页面没有使用到的变量发生变化了同样也会重新渲染页面这里就习惯这样写了),而在使用ts之后如下方式写@Component
那里编译就报错了Decorators are not valid here.
,所以想请教一下大佬该怎么在外面定义变量?
import { Component, Vue } from 'vue-property-decorator'
@Component({
components: {
Header,
},
})
let authTimeTimer: null | number = null
export default class Components extends Vue {}
第二个问题
@Component 是装饰器 用来装饰 class Components 的
你在装饰器和被装饰类之间插入语句是几个意思???
改成如下