Skip to content

Commit 9ebd5be

Browse files
author
kongbin02
committed
clipboard
1 parent b60559c commit 9ebd5be

File tree

12 files changed

+382
-26
lines changed

12 files changed

+382
-26
lines changed

package-lock.json

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"sortablejs": "^1.10.0-rc3",
1616
"text-loader": "0.0.1",
1717
"vue": "^2.5.2",
18+
"vue-clipboard2": "^0.3.1",
1819
"vue-code-diff": "0.0.4",
1920
"vue-markdown": "^2.2.4",
2021
"vue-router": "^3.0.1",

src/layouts/left_menu_data.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ const left_menu_data = [
99
to: '/diff',
1010
img:'../../static/img/diff.png'
1111
},
12+
{
13+
label: '复制文件',
14+
to: '/clipboard',
15+
img:'../../static/img/clipboard.png'
16+
},
1217
]
1318

1419
export {left_menu_data}

src/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import App from './App'
55
import router from './router'
66
import Quasar from './plugins/quasar'
77
import './css/theme'
8+
import Clipboard from './plugins/clipboard'
9+
import Notify from './plugins/PpNotify'
810

911
Vue.config.productionTip = false
1012

@@ -19,7 +21,7 @@ const app = {
1921
};
2022

2123

22-
[Quasar].forEach(plugin => plugin({
24+
[Quasar, Clipboard, Notify].forEach(plugin => plugin({
2325
app,
2426
router,
2527
Vue

src/pages/clipboard/index.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
export default {
2+
name: 'clipboard_index',
3+
data: () => ({
4+
value: '复制文本控件使用的是vue-clipboard2,可方便的实现复制需求。'
5+
}),
6+
methods: {
7+
copy_value() {
8+
this.$copyText(this.value).then(() => {
9+
this.$q.ok('已经复制到粘贴板!')
10+
}, () => {
11+
this.$q.err('复制失败!')
12+
})
13+
},
14+
},
15+
render(h) {
16+
return h('div', {
17+
staticClass: 'row no-wrap q-pa-sm'
18+
}, [
19+
h('div', {
20+
staticClass: 'pp-border-4 q-pa-sm text-tertiary test-weight-medium'
21+
}, [
22+
this.value
23+
]),
24+
h('q-btn', {
25+
props: {
26+
label: '点击复制',
27+
flat: true,
28+
color: 'primary'
29+
},
30+
on: {
31+
click: () => {
32+
this.copy_value()
33+
}
34+
}
35+
})
36+
])
37+
}
38+
}

src/pages/home/index.js

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,42 @@ export default {
66
methods: {
77
render_module_item(h, d) {
88
return h('div', {
9-
staticClass: 'pp-border-4 cursor-pointer pp-intro-div q-pa-sm',
9+
staticClass: 'q-pa-sm',
1010
style: {
1111
height: '160px',
12-
width:'400px'
12+
width: '400px'
1313
},
14-
on: {
15-
click: () => this.$router.push({path: d.url})
16-
}
1714
}, [
1815
h('div', {
19-
staticClass: 'q-mt-sm row no-wrap items-center'
16+
staticClass: 'pp-border-4 cursor-pointer pp-intro-div q-pa-sm full-height',
17+
on: {
18+
click: () => this.$router.push({path: d.url})
19+
}
2020
}, [
21-
h('img', {
22-
style: {
23-
width: '40px',
24-
height: '40px',
25-
borderRadius:'50%'
26-
},
27-
attrs: {
28-
src: d.img
29-
}
30-
}),
3121
h('div', {
32-
staticClass: 'q-ml-sm text-weight-bold text-tertiary font-20'
22+
staticClass: 'row no-wrap items-center'
3323
}, [
34-
d.title
24+
h('img', {
25+
style: {
26+
width: '40px',
27+
height: '40px',
28+
borderRadius: '50%'
29+
},
30+
attrs: {
31+
src: d.img
32+
}
33+
}),
34+
h('div', {
35+
staticClass: 'q-ml-sm text-weight-bold text-tertiary font-20'
36+
}, [
37+
d.title
38+
]),
3539
]),
36-
]),
37-
h('div', {
38-
staticClass: 'text-weight-medium text-faded font-13 q-mt-sm'
39-
}, [
40-
d.description
40+
h('div', {
41+
staticClass: 'text-weight-medium text-faded font-13 q-mt-sm'
42+
}, [
43+
d.description
44+
])
4145
])
4246
])
4347
},

src/plugins/PpNotify.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.pp-notification-top-enter {
2+
opacity: 0;
3+
-webkit-transform: translateY(-50px);
4+
transform: translateY(-50px);
5+
z-index: 9499;
6+
}
7+
8+
.pp-notification-top-leave-to {
9+
opacity: 0;
10+
z-index: 9499;
11+
}
12+
13+
.pp-notification-top-right-enter {
14+
opacity: 0;
15+
-webkit-transform: translateX(100%);
16+
transform: translateX(100%);
17+
z-index: 9499;
18+
}
19+
20+
.pp-notification-top-right-leave-to {
21+
opacity: 0;
22+
-webkit-transform: translateX(100%);
23+
transform: translateX(100%);
24+
z-index: 9499;
25+
}

0 commit comments

Comments
 (0)