gpt4 book ai didi

vuejs2 - VUEJS - 为什么我得到 : Uncaught TypeError: Right-hand side of 'instanceof' ?

转载 作者:行者123 更新时间:2023-12-02 07:14:42 24 4
gpt4 key购买 nike

我在 vue.js 中遇到有关“Uncaught TypeError: Right-hand side of 'instanceof' is not an object”的问题。

我使用的是 Vue 2.2.1 版本,以下是我遇到此问题的代码片段。

Vue.component('componentName', {
'template': ``,
props: {
contentTypeUid: {
type: 'string',
required: false
},
limit: {
type: 'number',
required: false,
default: 10
}
},
......
});

虽然如果不是上面的下面的工作没有任何问题,但我想使用上面的格式,因为我需要在 Prop 上指定一些验证和默认值。

Vue.component('componentName', {
'template': ``,
props: ["contentTypeUid", "limit"],
......
});

谢谢。

最佳答案

用途:

props: {
contentTypeUid: {
type: String, // not 'string'
required: false
},
limit: {
type: Number, // not 'number'
required: false,
default: 10
}
},

关于vuejs2 - VUEJS - 为什么我得到 : Uncaught TypeError: Right-hand side of 'instanceof' ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52852649/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com