You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
< template >
< div >
< el -button size = "small" type = "primary" icon = "el-icon-s-order" @click ="$refs['formList'].show()" > 表 单 中 心 选 择 < / el -button >
< el -button size = "small" type = "primary" icon = "el-icon-plus" > 表单新增 < / e l - b u t t o n >
< el -upload
class = "upload"
ref = "upload"
:action ="action"
:file-list ="fileList"
:auto-upload ="false" >
< el -button slot = "trigger" size = "small" type = "primary" > 选取文件 < / e l - b u t t o n >
< el -button style = "margin-left: 10px;" size = "small" type = "success" @ click = "" > 上传到服务器 < / e l - b u t t o n >
< div slot = "tip" class = "el-upload__tip" > 只能上传jpg / png文件 , 且不超过500kb < / div >
< / e l - u p l o a d >
< formList ref = "formList" :value ="selections" @selected ="selectedHandler" > < / formList >
< / div >
< / template >
< script >
import formList from './formList.vue' ;
export default {
components : {
formList
} ,
props : {
form : Object ,
fieldInfo : Object ,
file : Object ,
} ,
data ( ) {
return {
action : process . env . VUE _APP _UPLOAD _API ,
selections : [ ] ,
}
} ,
methods : {
selectedHandler ( ids ) {
this . selections = Array . from ( new Set ( ids ) )
this . $emit ( 'update' , this . selections )
}
} ,
computed : {
fileList ( ) {
return ( this . file && this . fieldInfo ? . field ) ? this . file [ this . fieldInfo . field ] : [ ]
} ,
} ,
watch : {
form : {
handler ( newVal ) {
this . selections = newVal [ this . fieldInfo . field ]
} ,
immediate : true
}
}
}
< / script >
< style scoped lang = "scss" >
. upload {
margin - top : 10 px ;
}
< / style >