Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Chatopera OpenSource
/
ferry_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
792a119e
authored
Nov 03, 2020
by
YuleiLan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复上传文件bug
parent
d6ad63cf
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
src/components/VueFormMaking/components/GenerateFormItem.vue
src/components/VueFormMaking/components/Upload/file.vue
src/components/VueFormMaking/components/GenerateFormItem.vue
View file @
792a119e
...
...
@@ -265,7 +265,7 @@
</
template
>
<
template
v-if=
"widget.type=='file'"
>
<FileUpload
:element=
"widget"
/>
<FileUpload
:element=
"widget"
:data-model=
"dataModel"
@
fileList=
"fileList"
/>
</
template
>
<
template
v-if=
"widget.type === 'editor'"
>
...
...
@@ -414,6 +414,9 @@ export default {
}
},
methods
:
{
fileList
(
files
)
{
this
.
dataModel
=
files
}
}
}
</
script
>
...
...
src/components/VueFormMaking/components/Upload/file.vue
View file @
792a119e
...
...
@@ -10,7 +10,7 @@
:limit=
"element.options.length"
:headers=
"element.options.headers"
:on-exceed=
"handleExceed"
:file-list=
"
element.options.defaultValue
"
:file-list=
"
dataModel
"
:disabled=
"element.options.disabled"
:style=
"
{'width': element.options.width}"
>
...
...
@@ -26,15 +26,15 @@
export
default
{
name
:
'FileUpload'
,
// eslint-disable-next-line vue/require-prop-types
props
:
[
'element'
,
'preview'
],
props
:
[
'element'
,
'preview'
,
'dataModel'
],
data
()
{
return
{
currentRemoveUid
:
''
fileListTmp
:
[]
}
},
methods
:
{
handleRemove
(
file
,
fileList
)
{
this
.
element
.
options
.
defaultValue
=
fileList
this
.
$emit
(
'fileList'
,
fileList
)
},
handlePreview
(
file
)
{
window
.
open
(
file
.
url
,
'_blank'
)
...
...
@@ -43,14 +43,15 @@ export default {
this
.
$message
.
warning
(
`最多允许上传
${
this
.
element
.
options
.
length
}
个文件。`
)
},
beforeRemove
(
file
,
fileList
)
{
this
.
currentRemoveUid
=
file
.
uid
return
this
.
$confirm
(
`确定要移除
${
file
.
name
}
?`
)
},
handleSuccess
(
response
,
file
,
fileList
)
{
this
.
element
.
options
.
defaultValue
.
push
({
this
.
fileListTmp
.
push
({
uid
:
file
.
uid
,
name
:
file
.
name
,
url
:
response
.
data
})
this
.
$emit
(
'fileList'
,
this
.
fileListTmp
)
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment