form-create icon indicating copy to clipboard operation
form-create copied to clipboard

upload 上传文件内容 怎么不在表单中,我的场景是autoUpload: false 最终提交上传

Open fit2-zhao opened this issue 4 years ago • 2 comments

fit2-zhao avatar Aug 17 '21 03:08 fit2-zhao

这个内置的 upload 组件不支持, 建议通过自定义组件实现

xaboy avatar Aug 17 '21 04:08 xaboy

@xaboy 您好,自定义组件 httpRequest 这个事件无法触发

formCreate.component('msUpload', { render($h) { return $h('ElUpload', { props: { action: "", uploadType: "file", showFileList: true, autoUpload: false, fileList: this.fileList, httpRequest: this.onClick, limit: 2 }, on: { httpRequest: () => { this.onClick() } } }, ['点击上传']) }, data: function () { return { fileList: [{name: 'food.jpg', url: 'https://xxx.cdn.com/xxx.jpg'}] } }, props: {}, methods: { onClick: function (file) { console.log(file) if(file) { this.fileList.push(file); } }, }, })

fit2-zhao avatar Aug 17 '21 04:08 fit2-zhao