From 3739301d83337277495e98ff00167d1bd24cfb27 Mon Sep 17 00:00:00 2001 From: ch Date: Wed, 29 Jun 2022 21:56:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E5=85=A8=E5=B1=80=E6=A0=B7=E5=BC=8F=E4=B8=A2?= =?UTF-8?q?=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 9 ++++++++- src/common/router/index.js | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) 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(); }); // 全局路由后置守卫