Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

上传组件如何限制上传文件数量 #176

Open
89trillion-feiyang opened this issue Aug 26, 2022 · 2 comments
Open

上传组件如何限制上传文件数量 #176

89trillion-feiyang opened this issue Aug 26, 2022 · 2 comments

Comments

@89trillion-feiyang
Copy link

zsbd

@lucky-wwww
Copy link

在parser中对上传组件添加before-upload进行数量限制

@txl945
Copy link

txl945 commented Jan 24, 2024

在parser中对上传组件添加before-upload进行数量限制
你好,请问我在render中注入了before-upload函数
if (this.conf.config.tag === 'el-upload') {
// 上传表单元素组件 的成功和移除事件;
dataObject.attrs['on-success'] = (response, file, fileList) => {
this.$emit('upload', response, file, fileList)
}
dataObject.attrs['on-remove'] = (file, fileList) => {
this.$emit('deleteUpload', file, fileList)
}
dataObject.attrs['on-preview'] = (file) => {
this.$emit('download', file)
}
dataObject.attrs['before-upload']=(file) =>{
this.$emit('beforeUpload',file)
}
return
}
Parser中也加入到了listener,但是没有触发是怎么回事呀
function buildListeners(scheme) {

const config = scheme.config
const methods = this.formConf.methods || {}
const listeners = {}

// 给__methods__中的方法绑定this和event
Object.keys(methods).forEach(key => {
listeners[key] = event => methods[key].call(this, event)
})
// 响应 render.js 中的 vModel $emit('input', val)
listeners.input = event => setValue.call(this, event, config, scheme)
listeners.upload = (response, file, fileList) => setUpload.call(this, config, scheme,response, file, fileList)
listeners.deleteUpload = (file, fileList) => deleteUpload.call(this, config, scheme,file, fileList)
listeners.download = (file) => download.call(this, file)
listeners.beforeUpload=(file) =>beforeUpload.call(this,file,scheme)
return listeners
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants