• 赚钱入口【需求资源】限时招募流量主、渠道主,站长合作;【合作模式】CPS长期分成,一次推广永久有收益。主动打款,不扣量;

VueJS + TypeScript decorator issue

Vue cps12345 1年前 (2020-07-14) 279次浏览 0个评论

报错

ERROR in /Users/JohnSmith/test/src/components/HelloWorld.vue
37:1 Unable to resolve signature of class decorator when called as an expression.
  Type '<VC extends VueClass<Vue>>(target: VC) => VC' is missing the following properties from type 'typeof HelloWorld': extend, nextTick, set, delete, and 7 more.
    35 | import { Component, Prop, Vue } from 'vue-property-decorator';
    36 | 
  > 37 | @Component
       | ^
    38 | export default class HelloWorld extends Vue {
    39 |   @Prop() private msg!: string;
    40 | }

解决方案

Try to import Vue from vue … like:

import Vue from 'vue';
@Component
export default class HelloWorld extends Vue {
  @Prop() private msg!: string;
}

 

喜欢 (0)

您必须 登录 才能发表评论!