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

表单显示时 el-upload 怎么回显数据 #153

Closed
yiyoxy opened this issue Feb 18, 2022 · 3 comments
Closed

表单显示时 el-upload 怎么回显数据 #153

yiyoxy opened this issue Feb 18, 2022 · 3 comments

Comments

@yiyoxy
Copy link

yiyoxy commented Feb 18, 2022

form-generator 制作并保存了表单 json,表单运行时 el-upload选择文件上传 能正常显示 并且能上传成功。查看表单信息时 formjson 和 formdata 都有值,但el-upload并不能回显图片。 #125 按照这个修改,也不能显示 数据库 查询出来的图片。求教。

@JakHuang
Copy link
Owner

@JakHuang JakHuang closed this as completed Mar 6, 2022
@yiyoxy
Copy link
Author

yiyoxy commented Mar 7, 2022

我是在render.js里修改的,给file-list赋值。但如果上传了多张图片,vModel会执行多次,el-upload会渲染多次,有闪动现象,但好歹能回显 后台返回的图片了。
function vModel(dataObject, defaultValue, config) {
if(config !== undefined && config !== null && config !== '' && 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)
}
if (defaultValue !== undefined && defaultValue !== null && defaultValue !=='') {
dataObject.attrs['file-list'] = JSON.parse(defaultValue)
}
return
}
dataObject.props.value = defaultValue

dataObject.on.input = val => {
this.$emit('input', val)
}
}

@cksspk
Copy link

cksspk commented Mar 9, 2022

我是在render.js里的,给文件列表修改的,但如果上传了很多图片,但如果上传了很多图片,el-upload会渲染多次,有返回效果,后台好歹能闪回显示。 function vModel (dataObject, defaultValue, config) { if(config !== undefined && config !== null && config !== '' && 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) } if (defaultValue !== undefined && defaultValue !== null && defaultValue !=='') { dataObject.attrs['file-list'] = JSON。解析(默认值) } 返回 } dataObject.props.value = defaultValue

dataObject.on.input = val => { this.$emit('input', val) } }

upload渲染多次怎么解决的?

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