diff --git a/public/index.html b/public/index.html index ff730ce..95261b0 100644 --- a/public/index.html +++ b/public/index.html @@ -1,3 +1,10 @@ + @@ -14,7 +21,7 @@ - + diff --git a/src/common/router/index.js b/src/common/router/index.js index 94ed84a..8763bd8 100644 --- a/src/common/router/index.js +++ b/src/common/router/index.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-03-18 11:11:05 * @LastEditors: ch - * @LastEditTime: 2022-03-18 11:11:05 + * @LastEditTime: 2022-06-29 21:53:26 * @Description: file content */ import {RouterMount,createRouter} from 'uni-simple-router'; @@ -13,6 +13,10 @@ const router = createRouter({ }); //全局路由前置守卫 router.beforeEach((to, from, next) => { + // 兼容页面刷新body样式丢失问题 + if (document.body) { + document.body.setAttribute('class', `uni-body ${to.path.replace('/', '').replace(/\//g, '-')}`) + } next(); }); // 全局路由后置守卫