Browse Source

fix: Page switching display is abnormal

vben 9 months ago
parent
commit
89586ef2c4

+ 1 - 0
Dockerfile

@@ -20,6 +20,7 @@ RUN echo "Builder Success 🎉"
 
 FROM nginx:stable-alpine as production
 
+RUN echo "types { application/javascript js mjs; }" > /etc/nginx/conf.d/mjs.conf
 COPY --from=builder /app/apps/antd-view/dist /usr/share/nginx/html
 
 COPY ./deploy/nginx.conf /etc/nginx/nginx.conf

+ 3 - 15
internal/vite-config/src/plugins/license.ts

@@ -1,6 +1,5 @@
 import type {
   NormalizedOutputOptions,
-  OutputAsset,
   OutputBundle,
   OutputChunk,
 } from 'rollup';
@@ -45,25 +44,14 @@ async function viteLicensePlugin(
               `.trim();
 
         for (const [, fileContent] of Object.entries(bundle)) {
-          if (
-            fileContent.type === 'asset' ||
-            (fileContent.type === 'chunk' && fileContent.isEntry)
-          ) {
+          if (fileContent.type === 'chunk' && fileContent.isEntry) {
             const chunkContent = fileContent as OutputChunk;
-            const assetContent = fileContent as OutputAsset;
             // 插入版权信息
-            const content =
-              typeof assetContent.source === 'string'
-                ? assetContent.source
-                : chunkContent.code;
+            const content = chunkContent.code;
             const updatedContent = `${copyrightText}${EOL}${content}`;
 
             // 更新bundle
-            if (assetContent.source === undefined) {
-              (fileContent as OutputChunk).code = updatedContent;
-            } else {
-              (fileContent as OutputAsset).source = updatedContent;
-            }
+            (fileContent as OutputChunk).code = updatedContent;
           }
         }
       },

+ 2 - 7
packages/business/layouts/src/basic/content/content.vue

@@ -12,7 +12,7 @@ defineOptions({ name: 'LayoutContent' });
 
 const { keepAlive } = usePreferences();
 const tabsStore = useTabsStore();
-const { onTransitionEnd, spinning } = useContentSpinner();
+const { spinning } = useContentSpinner();
 
 const { getCacheTabs, getExcludeTabs, renderRouteView } =
   storeToRefs(tabsStore);
@@ -51,12 +51,7 @@ function getTransitionName(route: RouteLocationNormalizedLoaded) {
     />
     <IFrameRouterView />
     <RouterView v-slot="{ Component, route }">
-      <Transition
-        :name="getTransitionName(route)"
-        appear
-        mode="out-in"
-        @transitionend="onTransitionEnd"
-      >
+      <Transition :name="getTransitionName(route)" appear mode="out-in">
         <KeepAlive
           v-if="keepAlive"
           :exclude="getExcludeTabs"

+ 3 - 9
packages/business/layouts/src/basic/content/use-content-spinner.ts

@@ -5,7 +5,6 @@ import { preferences } from '@vben-core/preferences';
 
 function useContentSpinner() {
   const spinning = ref(false);
-  const isStartTransition = ref(false);
   const startTime = ref(0);
   const router = useRouter();
   const minShowTime = 500;
@@ -29,7 +28,6 @@ function useContentSpinner() {
     if (to.meta.loaded || !enableLoading.value) {
       return true;
     }
-    isStartTransition.value = false;
     startTime.value = performance.now();
     spinning.value = true;
     return true;
@@ -40,17 +38,13 @@ function useContentSpinner() {
       return true;
     }
 
-    // 未进入过渡动画
-    if (!isStartTransition.value) {
-      // 关闭加载动画
-      onEnd();
-    }
+    // 关闭加载动画
+    onEnd();
 
-    isStartTransition.value = false;
     return true;
   });
 
-  return { onTransitionEnd: onEnd, spinning };
+  return { spinning };
 }
 
 export { useContentSpinner };

+ 1 - 1
packages/locales/src/langs/zh-CN.yaml

@@ -181,7 +181,7 @@ preferences:
     name: 动画
     loading: 页面切换 Loading
     transition: 页面切换动画
-    progress: 页面加载进度条
+    progress: 页面切换进度条
   theme:
     name: 主题
     builtin: 内置主题