HDB*_*HDB 6 vue-component vuejs2
我在vue.js中遇到有关“未捕获的TypeError:'instanceof'的右侧不是对象”的问题。
我正在使用Vue 2.2.1版本,以下是我遇到此问题的代码段。
Vue.component('componentName', {
'template': ``,
props: {
contentTypeUid: {
type: 'string',
required: false
},
limit: {
type: 'number',
required: false,
default: 10
}
},
......
});
Run Code Online (Sandbox Code Playgroud)
虽然如果不是在上面进行下面的工作没有任何问题,但是我想使用上面的格式,因为我需要在道具上指定一些验证和默认值。
Vue.component('componentName', {
'template': ``,
props: ["contentTypeUid", "limit"],
......
});
Run Code Online (Sandbox Code Playgroud)
谢谢。
小智 11
使用:
props: {
contentTypeUid: {
type: String, // not 'string'
required: false
},
limit: {
type: Number, // not 'number'
required: false,
default: 10
}
},
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7499 次 |
| 最近记录: |