Skip to content

Commit 94c61e8

Browse files
committed
修复详情页报错
1 parent 71a1971 commit 94c61e8

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

nuxt.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ module.exports = {
5757
{
5858
src: '~/plugins/lib-flexible.js',
5959
mode: 'client'
60+
},
61+
{
62+
src: '~/plugins/clipboard.js',
63+
mode: 'client'
6064
}
6165
],
6266
/*

pages/detail/_id.vue

+1-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ import dayjs from 'dayjs'
5454
import 'highlight.js/scss/default.scss'
5555
import 'github-markdown-css/github-markdown.css'
5656
import 'highlight.js/styles/vs2015.css'
57-
import Clipboard from 'clipboard'
5857
5958
export default {
6059
name: 'Detail',
@@ -133,7 +132,7 @@ export default {
133132
},
134133
mounted() {
135134
this.$nextTick(() => {
136-
this.clipboard = new Clipboard('.copy-btn')
135+
this.clipboard = new this.Clipboard('.copy-btn')
137136
this.clipboard.on('success', (e) => {
138137
this.$toast.success('复制成功')
139138
})

plugins/clipboard.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import Vue from 'vue'
2+
import Clipboard from 'clipboard'
3+
4+
Vue.prototype.Clipboard = Clipboard

0 commit comments

Comments
 (0)