vuejs/v2.cn.vuejs.org

怎么使用多重type

zc-write-code opened this issue · 1 comments

提示这个是什么意思

C:\Users\Administrator\Desktop\demo2\demo\src\components\EchartsComp.vue
30:23 error The "width" property should be a constructor vue/require-prop-type-constructor
34:23 error The "height" property should be a constructor vue/require-prop-type-constructor

✖ 2 problems (2 errors, 0 warnings) npm编译出现那个问题...
使用的
props:{ width: { type: Number | String, default: 500 }, height: { type: Number | String, default: 300 } }

好吧!使用多个type类型需要改成props:{width() { return { type: Number | String, default: 500 } }, height() { return { type: Number | String, default: 300 } }}但是父组件不传入这两个值会导致默认值得不到啊.....this.width及this.height为undefined