【发布时间】:2019-11-16 03:54:36
【问题描述】:
我想在另一个 props 的验证器中访问一个 props 值:
props: {
type: {
type: String,
default: "standard"
},
size: {
type: String,
default: "normal",
validator(value) {
// below I want to access the props `type` from above.
return (this.type !== "caution" || this.type !== "primary") && value !== "mega"
}
}
}
但我收到了TypeError: Cannot read property 'type' of undefined。
有什么想法吗?
【问题讨论】:
标签: vue.js vuejs2 vue-component