Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mould-vuecli3
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
lhfe
mould-vuecli3
Commits
24f3f8fe
Commit
24f3f8fe
authored
Aug 27, 2020
by
gaobowen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
screenshot
parent
ebc6e850
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
3 deletions
+51
-3
screenshot.vue
src/views/screenshot.vue
+51
-3
No files found.
src/views/screenshot.vue
View file @
24f3f8fe
<
template
>
<div
class=
"screenshot"
>
<div
class=
"content"
>
<video
id=
"screenshot-video"
></video>
<video
id=
"screenshot-video"
width=
"400"
height=
"300"
:src=
"srcUrl"
controls
></video>
</div>
<div
class=
"operate-area"
>
<input
id=
"screenshot-input"
type=
"file"
style=
"display:none;"
/>
<input
id=
"screenshot-input"
type=
"file"
style=
"display:none;"
@
change=
"changeFile"
/>
<label
id=
"select-btn"
>
选择文件
</label>
</div>
</div>
</
template
>
...
...
@@ -18,7 +19,47 @@ export default {
}
},
created
()
{},
mounted
()
{}
mounted
()
{
let
input
=
document
.
getElementById
(
'screenshot-input'
)
let
fileBtn
=
document
.
getElementById
(
'select-btn'
)
fileBtn
.
addEventListener
(
'click'
,
function
()
{
input
.
click
()
})
let
video
=
document
.
getElementById
(
'screenshot-video'
)
video
.
onerror
=
function
(
e
)
{
console
.
log
(
'onerror'
,
e
)
}
video
.
addEventListener
(
'loadedmetadata'
,
function
(
e
)
{
console
.
log
(
'loadedmetadata'
,
e
)
//webkitVideoDecodedByteCount
if
(
e
.
target
.
webkitVideoDecodedByteCount
<
1
)
{
console
.
error
(
'格式不支持'
)
}
})
//loadedmetadata
},
methods
:
{
selectClick
()
{},
changeFile
(
e
)
{
//console.log('changeFile', e)
if
(
e
.
target
.
files
[
0
])
{
this
.
srcUrl
=
URL
.
createObjectURL
(
e
.
target
.
files
[
0
])
// let _this = this
// let reader = new FileReader()
// reader.addEventListener(
// 'load',
// () => {
// console.log('_this.srcUrl', this)
// _this.srcUrl = reader.result
// },
// false
// )
// reader.readAsDataURL(e.target.files[0])
}
//e.target
}
}
}
</
script
>
...
...
@@ -30,8 +71,15 @@ export default {
display
:
flex
;
flex-direction
:
column
;
.content
{
height
:
90%
;
margin
:
20px
30px
;
background-color
:
lightcyan
;
}
.operate-area
{
#select-btn
{
width
:
200px
;
height
:
100px
;
}
}
}
</
style
>
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