示例代码在运行时,ts类型报错.原因是试图在可能为 undefined 的对象上使用扩展运算符.
@ -57,7 +57,7 @@ export default defineComponent({
};
const beforeUpload: UploadProps['beforeUpload'] = file => {
fileList.value = [...fileList.value, file];
fileList.value = [...(fileList.value || []), file];
return false;