关于typeScript数组,如何解决此错误

时间:2018-07-20 04:35:49

标签: arrays typescript

为什么错了?帮我。我该怎么办。看看img

@Prop(Array) menu!: object

created() {
    this.$nextTick(() => {
        bus.$emit('user', this.menu[0].childs)
    })
}

mounted() {

}

enter image description here

1 个答案:

答案 0 :(得分:0)

  

如果您将类型定义为,则无法访问属性childs   object。因此,您可以定义特定的类型,也可以使用   以下。

@Prop(Array) menu!: { [index : string] : any}