Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VueElementTemplate
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
黄瑜
VueElementTemplate
Commits
4f2f136d
Commit
4f2f136d
authored
Sep 27, 2017
by
Pan
Committed by
花裤衩
Sep 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add:add clipboard example
parent
8d53ae12
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
index.vue
src/views/clipboard/index.vue
+42
-0
No files found.
src/views/clipboard/index.vue
View file @
4f2f136d
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-tabs
v-model=
"activeName"
>
<el-tab-pane
label=
"use clipboard directly"
name=
"directly"
>
<el-input
v-model=
"inputData"
placeholder=
"请输入内容"
style=
'width:400px;'
></el-input>
<el-button
type=
"primary"
icon=
"document"
@
click=
'handleCopy(inputData,$event)'
>
copy
</el-button>
</el-tab-pane>
<el-tab-pane
label=
"use clipboard by v-directive"
name=
"v-directive"
>
<el-input
v-model=
"inputData"
placeholder=
"请输入内容"
style=
'width:400px;'
></el-input>
<el-button
type=
"primary"
icon=
"document"
v-clipboard:copy=
'inputData'
v-clipboard:success=
'clipboardSuccess'
>
copy
</el-button>
</el-tab-pane>
</el-tabs>
</div>
</
template
>
<
script
>
import
clip
from
'@/utils/clipboard'
// use clipboard directly
import
clipboard
from
'@/directive/clipboard/index.js'
// use clipboard by v-directive
export
default
{
directives
:
{
clipboard
},
data
()
{
return
{
activeName
:
'directly'
,
inputData
:
'https://github.com/PanJiaChen/vue-element-admin'
}
},
methods
:
{
handleCopy
(
text
,
event
)
{
clip
(
text
,
event
)
},
clipboardSuccess
()
{
this
.
$message
({
message
:
'复制成功'
,
type
:
'success'
,
duration
:
1500
})
}
}
}
</
script
>
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