From 4030b22f41efd6b357ae3687dc0f0e1a2d39c801 Mon Sep 17 00:00:00 2001 From: yige Date: Sun, 19 Jul 2020 20:13:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9B=BE=E7=89=87=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 1 + layouts/common.styl | 4 ++-- nuxt.config.js | 3 ++- package.json | 1 + pages/post/_id.vue | 4 ++-- plugins/v-viewer.js | 5 +++++ yarn.lock | 18 ++++++++++++++++++ 7 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 plugins/v-viewer.js diff --git a/.vscode/settings.json b/.vscode/settings.json index 6a5c941..3876f09 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,6 +13,7 @@ "nuxtjs", "styl", "vditor", + "viewerjs", "vmodal", "wangeditor" ] diff --git a/layouts/common.styl b/layouts/common.styl index 17c267c..b8a6598 100644 --- a/layouts/common.styl +++ b/layouts/common.styl @@ -87,7 +87,7 @@ footer position fixed right 8px bottom 8px - z-index 999 + z-index 998 padding 4px i @@ -510,7 +510,7 @@ input:-moz-placeholder @media (max-width 768px) .header position fixed - z-index 999999 + z-index 99999 width 100% display block box-sizing border-box diff --git a/nuxt.config.js b/nuxt.config.js index f70da28..f3814f8 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -83,7 +83,8 @@ module.exports = { ssr: false }, { src: '~/plugins/vue-js-modal', mode: 'client' }, - { src: '~/plugins/vue-toasted', mode: 'client' } + { src: '~/plugins/vue-toasted', mode: 'client' }, + { src: '~/plugins/v-viewer', mode: 'client' } ], /* diff --git a/package.json b/package.json index 5e636fa..970bfdf 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "koa": "^2.11.0", "moment": "^2.27.0", "nuxt": "^2.12.2", + "v-viewer": "^1.5.1", "vditor": "^3.3.8", "vue-js-modal": "^2.0.0-rc.3", "vue-toasted": "^1.1.28" diff --git a/pages/post/_id.vue b/pages/post/_id.vue index 6b0af36..53a1ca5 100644 --- a/pages/post/_id.vue +++ b/pages/post/_id.vue @@ -19,7 +19,7 @@ #articelToc.articelToc(v-if="articels.post_toc_show") .articelTitle 目录 .articelTocList(v-html="articels.post_toc") - .articelContent(v-html='articels.post_content') + .articelContent(v-html='articels.post_content', v-viewer) .tools .reward(@click="reward") 打赏 .comment(id="comment") @@ -31,7 +31,7 @@ .comment-area .comment-author {{ item.comment_author }} span(class="comment-status", v-if="item.comment_approved === '0'")   此内容正在审核中... - .comment-content(v-html="item.comment_content_html") + .comment-content(v-html="item.comment_content_html", v-viewer) .comment-info {{ item.comment_date }} span.reply(@click="reply(item.comment_ID, null, true)" v-if="replyLastID === null && item.comment_ID === replyID") 取消回复 span.reply(@click="reply(item.comment_ID, null)" v-else) 回复 diff --git a/plugins/v-viewer.js b/plugins/v-viewer.js new file mode 100644 index 0000000..6d649b2 --- /dev/null +++ b/plugins/v-viewer.js @@ -0,0 +1,5 @@ +import 'viewerjs/dist/viewer.css' +import Viewer from 'v-viewer' +import Vue from 'vue' + +Vue.use(Viewer) diff --git a/yarn.lock b/yarn.lock index c9d9959..9faff4b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8367,6 +8367,11 @@ thread-loader@^2.1.3: loader-utils "^1.1.0" neo-async "^2.6.0" +throttle-debounce@^2.0.1: + version "2.2.1" + resolved "https://registry.npm.taobao.org/throttle-debounce/download/throttle-debounce-2.2.1.tgz?cache=0&sync_timestamp=1591627153757&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fthrottle-debounce%2Fdownload%2Fthrottle-debounce-2.2.1.tgz#fbd933ae6793448816f7d5b3cae259d464c98137" + integrity sha1-+9kzrmeTRIgW99WzyuJZ1GTJgTc= + through2@^2.0.0: version "2.0.5" resolved "https://mirrors.huaweicloud.com/repository/npm/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" @@ -8815,6 +8820,14 @@ uuid@^3.3.2: resolved "https://mirrors.huaweicloud.com/repository/npm/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== +v-viewer@^1.5.1: + version "1.5.1" + resolved "https://registry.npm.taobao.org/v-viewer/download/v-viewer-1.5.1.tgz#94804d83814cca566e691339fe1e64793486f200" + integrity sha1-lIBNg4FMylZuaRM5/h5keTSG8gA= + dependencies: + throttle-debounce "^2.0.1" + viewerjs "^1.5.0" + v8-compile-cache@^2.0.3: version "2.1.0" resolved "https://mirrors.huaweicloud.com/repository/npm/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" @@ -8845,6 +8858,11 @@ vendors@^1.0.0: resolved "https://mirrors.huaweicloud.com/repository/npm/vendors/-/vendors-1.0.4.tgz#e2b800a53e7a29b93506c3cf41100d16c4c4ad8e" integrity sha512-/juG65kTL4Cy2su4P8HjtkTxk6VmJDiOPBufWniqQ6wknac6jNiXS9vU+hO3wgusiyqWlzTbVHi0dyJqRONg3w== +viewerjs@^1.5.0: + version "1.6.1" + resolved "https://registry.npm.taobao.org/viewerjs/download/viewerjs-1.6.1.tgz#719719898cbf7b63dd41763a0b4dabfa927ddfcf" + integrity sha1-cZcZiYy/e2PdQXY6C02r+pJ9388= + vm-browserify@^1.0.1: version "1.1.2" resolved "https://mirrors.huaweicloud.com/repository/npm/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"