Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
web-purchase
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张冬
web-purchase
Commits
080f5af5
Commit
080f5af5
authored
Sep 30, 2020
by
张冬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
90d666b3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
Upload.vue
src/components/Upload/Upload.vue
+2
-0
newUpload.vue
src/components/Upload/newUpload.vue
+8
-7
ceshi.vue
src/pages/ceshi.vue
+1
-1
No files found.
src/components/Upload/Upload.vue
View file @
080f5af5
...
@@ -123,7 +123,9 @@ export default {
...
@@ -123,7 +123,9 @@ export default {
// 调用 ali-oss 中的方法
// 调用 ali-oss 中的方法
put
(
`
${
objName
}${
option
.
file
.
name
}
`
,
option
.
file
).
then
(
res
=>
{
put
(
`
${
objName
}${
option
.
file
.
name
}
`
,
option
.
file
).
then
(
res
=>
{
console
.
log
(
res
)
console
.
log
(
res
)
this
.
fileList
.
push
(
res
)
console
.
log
(
this
.
fileList
)
console
.
log
(
this
.
fileList
)
this
.
emitInput
(
this
.
fileList
)
})
})
}
}
...
...
src/components/Upload/newUpload.vue
View file @
080f5af5
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
<
script
>
<
script
>
import
{
import
{
put
,
client1
,
getFileNameUUID
getFileNameUUID
}
from
'@api/ali-oss'
//前面的ali-js文件内的两个封装函数
}
from
'@api/ali-oss'
//前面的ali-js文件内的两个封装函数
...
@@ -26,7 +26,7 @@ import {
...
@@ -26,7 +26,7 @@ import {
props
:
{
props
:
{
limit
:
{
limit
:
{
type
:
Number
,
type
:
Number
,
default
:
1
default
:
5
}
}
},
},
data
()
{
data
()
{
...
@@ -55,10 +55,13 @@ import {
...
@@ -55,10 +55,13 @@ import {
return
this
.
$confirm
(
`确定移除
${
file
.
name
}
?`
);
return
this
.
$confirm
(
`确定移除
${
file
.
name
}
?`
);
},
},
// 文件列表移除文件时的钩子
// 文件列表移除文件时的钩子
handleRemove
(
file
,
fileList
)
{},
handleRemove
(
file
,
fileList
)
{
this
.
progress
=
0
},
// 文件上传成功时的钩子
// 文件上传成功时的钩子
handleSuccess
(
response
,
file
,
fileList
)
{
handleSuccess
(
response
,
file
,
fileList
)
{
this
.
fileList
=
fileList
;
this
.
fileList
=
fileList
;
this
.
$emit
(
'onsuccess'
,
fileList
)
},
},
//文件上传前的校验
//文件上传前的校验
beforeAvatarUpload
(
file
)
{
beforeAvatarUpload
(
file
)
{
...
@@ -82,16 +85,14 @@ import {
...
@@ -82,16 +85,14 @@ import {
fileNameLength
fileNameLength
);
);
let
fileName
=
getFileNameUUID
()
+
"."
+
fileFormat
;
let
fileName
=
getFileNameUUID
()
+
"."
+
fileFormat
;
client1
(
that
.
dataObj
)
client1
(
that
.
dataObj
).
multipartUpload
(
`videoTest/
${
fileName
}
`
,
file
.
file
,
{
.
multipartUpload
(
`videoTest/
${
fileName
}
`
,
file
.
file
,
{
progress
:
function
(
p
)
{
progress
:
function
(
p
)
{
//p进度条的值
//p进度条的值
console
.
log
(
p
);
console
.
log
(
p
);
that
.
showProgress
=
true
;
that
.
showProgress
=
true
;
that
.
progress
=
Math
.
floor
(
p
*
100
);
that
.
progress
=
Math
.
floor
(
p
*
100
);
}
}
})
}).
then
(
result
=>
{
.
then
(
result
=>
{
//上传成功返回值,可针对项目需求写其他逻辑
//上传成功返回值,可针对项目需求写其他逻辑
console
.
log
(
result
);
console
.
log
(
result
);
})
})
...
...
src/pages/ceshi.vue
View file @
080f5af5
<
template
>
<
template
>
<div>
<div>
<div
class=
"content"
>
<div
class=
"content"
>
<upload></upload>
<upload
@
onsuccess=
"\"
></upload>
<div
@
click=
"up"
>
上传
</div>
<div
@
click=
"up"
>
上传
</div>
</div>
</div>
</div>
</div>
...
...
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