为了账号安全,请及时绑定邮箱和手机立即绑定

vue-property-decorator @prop 如何定义 Array

vue-property-decorator @prop 如何定义 Array

江户川乱折腾 2018-09-02 11:32:58
'use strict'import Vue from 'vue'import { Prop, Watch } from 'vue-property-decorator'interface ITabs {     name: string     value: string}export default class extends Vue {    @Prop({        type: Array,        default() {            return []         }     })    public tabs!: ITabs[] // TS2416}TS2416: Property 'tabs' in type 'default' is not assignable to thesame property in base type 'object & Record<never,any> & Vue'. Type'ITabs[]' is not assignable totype '{ name: ""; value: ""; }[] |undefined'. Type 'ITabs[]' is not assignable to type '{ name: "";value: ""; }[]'. Type 'ITabs' is not assignable to type '{ name: "";value: ""; }'. Types of property 'name' are incompatible. Type'string' is not assignable to type '""'.
查看完整描述

1 回答

?
噜噜哒

TA贡献1784条经验 获得超7个赞

export default class extends Vue {    @Prop({        type: Array,        default() {            return []
        }
    })
    public tabs 
}


查看完整回答
反对 回复 2018-09-02
  • 1 回答
  • 0 关注
  • 4136 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信