今天寫了個上傳報了個錯,用的是
<pan-thumb :image="imagefile" />
報錯如下:
[Vue warn]: Invalid prop: type check failed for prop "image". Expected String with value "undefined", got Undefined
found in
---> <PanThumb> at src/components/PanThumb/index.vue
<ElFormItem> at packages/form/src/form-item.vue
<ElForm> at packages/form/src/form.vue
<Save> at src/views/edu/teacher/save.vue
<AppMain> at src/layout/components/AppMain.vue
<Layout> at src/layout/index.vue
<App> at src/App.vue
<Root>
無效屬性:屬性“image”的類型檢查失敗。
最後在imagefile+'' 解決了
<pan-thumb :image="imagefile+''" />
或者這樣也行:
pan-thumb :image="String(imagefile)" />