我想从字典中设置一个默认属性,如下所示:
props: {
title: {
type: String,
default: this.$t("basic.confirm"),
},
description: {
type: String,
}
}, ...
这$t
是一个vue-i18n,如果它没有在父类中定义,我想从字典中设置我的标题。但我得到了错误:
未捕获的类型错误:this.$t 不是函数
类似的错误如果我重新加载没有this
.
未捕获的 ReferenceError:$t 未定义
但是如果我在 mount 方法中注销这个值,它会很好地工作。
是否有从字典中设置默认属性的解决方案?
提前致谢!