Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
ferry_web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jianan
ferry_web
Commits
792a119e
Commit
792a119e
authored
Nov 03, 2020
by
YuleiLan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复上传文件bug
parent
d6ad63cf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
src/components/VueFormMaking/components/GenerateFormItem.vue
+4
-1
src/components/VueFormMaking/components/Upload/file.vue
+7
-6
No files found.
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