Commit 2c8549c5aa612b715aa3ac631f2ab07bcb7ab891
1 parent
bf0a3ea7
1、App.vue格式整理
2、优选库——优选页面监听visibilitychange事件
Showing
2 changed files
with
19 additions
and
7 deletions
src/App.vue
| 1 | <template> | 1 | <template> |
| 2 | - <div id="app"> | ||
| 3 | - <router-view></router-view> | ||
| 4 | - </div> | 2 | + <div id="app"> |
| 3 | + <router-view></router-view> | ||
| 4 | + </div> | ||
| 5 | </template> | 5 | </template> |
| 6 | 6 | ||
| 7 | <script> | 7 | <script> |
| 8 | - export default { | ||
| 9 | - name: "App" | ||
| 10 | - }; | 8 | + export default { |
| 9 | + name: "App" | ||
| 10 | + }; | ||
| 11 | </script> | 11 | </script> |
| 12 | 12 | ||
| 13 | <style rel="stylesheet/less" lang="less"> | 13 | <style rel="stylesheet/less" lang="less"> |
| 14 | - .mint-toast-text{ | 14 | + .mint-toast-text { |
| 15 | font-size: 30px !important; | 15 | font-size: 30px !important; |
| 16 | } | 16 | } |
| 17 | .mint-indicator-text { | 17 | .mint-indicator-text { |
| 18 | font-size: 30px !important; | 18 | font-size: 30px !important; |
| 19 | } | 19 | } |
| 20 | -</style> | 20 | -</style> |
| 21 | +</style> | ||
| 21 | \ No newline at end of file | 22 | \ No newline at end of file |
src/pages/optimization2/optimization2.vue
| @@ -632,6 +632,17 @@ | @@ -632,6 +632,17 @@ | ||
| 632 | }); | 632 | }); |
| 633 | } | 633 | } |
| 634 | } | 634 | } |
| 635 | + | ||
| 636 | + // 页面显示监听 | ||
| 637 | + document.addEventListener('visibilitychange', () => { | ||
| 638 | + | ||
| 639 | + // 页面显示出来了 | ||
| 640 | + if (document.hidden === false) { | ||
| 641 | + | ||
| 642 | + // 优选页面接口 | ||
| 643 | + this.index(); | ||
| 644 | + } | ||
| 645 | + }); | ||
| 635 | } | 646 | } |
| 636 | } | 647 | } |
| 637 | </script> | 648 | </script> |