12345678910111213141516171819202122232425262728293031323334353637383940 |
- <script>
- import {hasUpdate} from '@/utils/common.js'
- export default {
- onLaunch: function(options) {
- this.$store.dispatch('getUserInfo')
- this.$store.dispatch('getTabBar')
- },
- onShow: function(options) {
- console.log('App Show:',options)
- hasUpdate()
- uni.getSystemInfo({
- success: function (res) {
- if (res.windowWidth > 700) {
- const params=options.query//此处的query就是在pc分享钩子函数中拼接的参数
- let paramsStr=`xcxPath=${decodeURIComponent(options.path)}`
- for(const key in params){
- paramsStr=`${paramsStr}&${key}=${params[key]}`
- }
- console.log('进入pc');
- uni.reLaunch({
- url: `/pages/pc?${paramsStr}`,
- });
- }
- },
- fail:function(res){
- }
- })
- },
- onHide: function() {
- console.log('App Hide')
- }
- }
- </script>
- <style lang='scss'>
- @import "/wxcomponents/vant/common/index.wxss";
- /* 页面公共样式 */
- @import "./style/common.scss";
-
- </style>
|