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
633fb5ba
authored
Nov 03, 2020
by
lanyulei
Committed by
GitHub
Nov 03, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #45 from lanyulei/dev
fix: 修复上传文件bug
parents
7122fa86
792a119e
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 @
633fb5ba
...
@@ -265,7 +265,7 @@
...
@@ -265,7 +265,7 @@
</
template
>
</
template
>
<
template
v-if=
"widget.type=='file'"
>
<
template
v-if=
"widget.type=='file'"
>
<FileUpload
:element=
"widget"
/>
<FileUpload
:element=
"widget"
:data-model=
"dataModel"
@
fileList=
"fileList"
/>
</
template
>
</
template
>
<
template
v-if=
"widget.type === 'editor'"
>
<
template
v-if=
"widget.type === 'editor'"
>
...
@@ -414,6 +414,9 @@ export default {
...
@@ -414,6 +414,9 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
fileList
(
files
)
{
this
.
dataModel
=
files
}
}
}
}
}
</
script
>
</
script
>
...
...
src/components/VueFormMaking/components/Upload/file.vue
View file @
633fb5ba
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
:limit=
"element.options.length"
:limit=
"element.options.length"
:headers=
"element.options.headers"
:headers=
"element.options.headers"
:on-exceed=
"handleExceed"
:on-exceed=
"handleExceed"
:file-list=
"
element.options.defaultValue
"
:file-list=
"
dataModel
"
:disabled=
"element.options.disabled"
:disabled=
"element.options.disabled"
:style=
"
{'width': element.options.width}"
:style=
"
{'width': element.options.width}"
>
>
...
@@ -26,15 +26,15 @@
...
@@ -26,15 +26,15 @@
export
default
{
export
default
{
name
:
'FileUpload'
,
name
:
'FileUpload'
,
// eslint-disable-next-line vue/require-prop-types
// eslint-disable-next-line vue/require-prop-types
props
:
[
'element'
,
'preview'
],
props
:
[
'element'
,
'preview'
,
'dataModel'
],
data
()
{
data
()
{
return
{
return
{
currentRemoveUid
:
''
fileListTmp
:
[]
}
}
},
},
methods
:
{
methods
:
{
handleRemove
(
file
,
fileList
)
{
handleRemove
(
file
,
fileList
)
{
this
.
element
.
options
.
defaultValue
=
fileList
this
.
$emit
(
'fileList'
,
fileList
)
},
},
handlePreview
(
file
)
{
handlePreview
(
file
)
{
window
.
open
(
file
.
url
,
'_blank'
)
window
.
open
(
file
.
url
,
'_blank'
)
...
@@ -43,14 +43,15 @@ export default {
...
@@ -43,14 +43,15 @@ export default {
this
.
$message
.
warning
(
`最多允许上传
${
this
.
element
.
options
.
length
}
个文件。`
)
this
.
$message
.
warning
(
`最多允许上传
${
this
.
element
.
options
.
length
}
个文件。`
)
},
},
beforeRemove
(
file
,
fileList
)
{
beforeRemove
(
file
,
fileList
)
{
this
.
currentRemoveUid
=
file
.
uid
return
this
.
$confirm
(
`确定要移除
${
file
.
name
}
?`
)
return
this
.
$confirm
(
`确定要移除
${
file
.
name
}
?`
)
},
},
handleSuccess
(
response
,
file
,
fileList
)
{
handleSuccess
(
response
,
file
,
fileList
)
{
this
.
element
.
options
.
defaultValue
.
push
({
this
.
fileListTmp
.
push
({
uid
:
file
.
uid
,
name
:
file
.
name
,
name
:
file
.
name
,
url
:
response
.
data
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