Showing
4 changed files
with
37 additions
and
1 deletions
@@ -5,6 +5,7 @@ import {createStore} from './store'; | @@ -5,6 +5,7 @@ import {createStore} from './store'; | ||
5 | import 'filters'; | 5 | import 'filters'; |
6 | import 'directives'; | 6 | import 'directives'; |
7 | import titleMixin from './mixins/title'; | 7 | import titleMixin from './mixins/title'; |
8 | +import downloadMixin from './mixins/download'; | ||
8 | import pluginCore from './plugins/core'; | 9 | import pluginCore from './plugins/core'; |
9 | import lazyload from 'vue-lazyload'; | 10 | import lazyload from 'vue-lazyload'; |
10 | import reportError from 'report-error'; | 11 | import reportError from 'report-error'; |
@@ -19,6 +20,7 @@ Vue.use(lazyload, { | @@ -19,6 +20,7 @@ Vue.use(lazyload, { | ||
19 | }); | 20 | }); |
20 | Vue.use(pluginCore); | 21 | Vue.use(pluginCore); |
21 | Vue.mixin(titleMixin); | 22 | Vue.mixin(titleMixin); |
23 | +Vue.mixin(downloadMixin); | ||
22 | dayjs.locale('zh-cn'); | 24 | dayjs.locale('zh-cn'); |
23 | dayjs.extend(relativeTime); | 25 | dayjs.extend(relativeTime); |
24 | 26 |
apps/mixins/download.js
0 → 100644
1 | +const serverDownloadMixin = { | ||
2 | + methods: { | ||
3 | + isDownloadBarHide() { | ||
4 | + return true; | ||
5 | + } | ||
6 | + } | ||
7 | +}; | ||
8 | + | ||
9 | +const clientDownloadMixin = { | ||
10 | + methods: { | ||
11 | + isDownloadBarHide() { | ||
12 | + return document.getElementById('no-download'); | ||
13 | + } | ||
14 | + } | ||
15 | +}; | ||
16 | + | ||
17 | +export default process.env.VUE_ENV === 'server' ? | ||
18 | + serverDownloadMixin : | ||
19 | + clientDownloadMixin; |
1 | <template> | 1 | <template> |
2 | - <a class="openapp-btn hover-opacity" href="javascript:;" @click="toDownloadPage"> | 2 | + <a v-if="visible" class="openapp-btn hover-opacity" href="javascript:;" @click="toDownloadPage"> |
3 | <span class="avatar-block"> | 3 | <span class="avatar-block"> |
4 | <div class="avatar"></div> | 4 | <div class="avatar"></div> |
5 | </span> | 5 | </span> |
@@ -10,6 +10,16 @@ | @@ -10,6 +10,16 @@ | ||
10 | 10 | ||
11 | <script> | 11 | <script> |
12 | export default { | 12 | export default { |
13 | + data() { | ||
14 | + return { | ||
15 | + visible: true | ||
16 | + }; | ||
17 | + }, | ||
18 | + mounted() { | ||
19 | + if (this.isDownloadBarHide()) { | ||
20 | + this.visible = false; | ||
21 | + } | ||
22 | + }, | ||
13 | methods: { | 23 | methods: { |
14 | toDownloadPage() { | 24 | toDownloadPage() { |
15 | this.$openApp(); | 25 | this.$openApp(); |
@@ -12,6 +12,11 @@ export default { | @@ -12,6 +12,11 @@ export default { | ||
12 | }; | 12 | }; |
13 | }, | 13 | }, |
14 | mounted() { | 14 | mounted() { |
15 | + if (this.isDownloadBarHide()) { | ||
16 | + this.visible = false; | ||
17 | + return; | ||
18 | + } | ||
19 | + | ||
15 | this.getDownloadElem((elem) => { | 20 | this.getDownloadElem((elem) => { |
16 | const newElem = this.handleElem(elem.cloneNode(true)); | 21 | const newElem = this.handleElem(elem.cloneNode(true)); |
17 | 22 |
-
Please register or login to post a comment