Sfoglia il codice sorgente

更新rspack配置以启用Vue功能标志,调整主入口文件以设置相关选项,并优化样式文件,删除不必要的导入。重构重定向组件的代码格式,确保一致性和可读性。

xbx 2 settimane fa
parent
commit
a152d31f31
5 ha cambiato i file con 27 aggiunte e 23 eliminazioni
  1. 3 2
      config/rspack.base.config.ts
  2. 8 1
      src/main.ts
  3. 2 0
      src/styles/index.css
  4. 0 6
      src/styles/index.scss
  5. 14 14
      src/views/redirect/index.vue

+ 3 - 2
config/rspack.base.config.ts

@@ -156,8 +156,9 @@ export const baseConfig = {
       },
     }),
     new rspack.DefinePlugin({
-      // __VUE_OPTIONS_API__: true,
-      // __VUE_PROD_DEVTOOLS__: false,
+      __VUE_OPTIONS_API__: 'true',
+      __VUE_PROD_DEVTOOLS__: 'false',
+      __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'false',
       API_BASE_URL: JSON.stringify(process.env.API_BASE_URL),
       'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
     }),

+ 8 - 1
src/main.ts

@@ -1,10 +1,17 @@
+import './styles/index.css';
 import './styles/index.scss';
 import { createApp } from 'vue';
 import App from './App.vue';
 import router from './router';
 import store from './store';
 
-
+// 设置 Vue 功能标志
+// @ts-ignore - 添加 Vue 功能标志
+window.__VUE_OPTIONS_API__ = true;
+// @ts-ignore
+window.__VUE_PROD_DEVTOOLS__ = process.env.NODE_ENV !== 'production';
+// @ts-ignore
+window.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ = process.env.NODE_ENV !== 'production';
 
 const app = createApp(App);
 

+ 2 - 0
src/styles/index.css

@@ -0,0 +1,2 @@
+/* 导入 Tailwind CSS */
+@import "tailwindcss"; 

+ 0 - 6
src/styles/index.scss

@@ -1,9 +1,4 @@
-/* 导入 Tailwind CSS */
-@import "tailwindcss";
-
 /* 导入变量和重置样式 */
-@import "./variables.scss";
-@import "./reset.scss";
 
 /* 全局样式 */
 :root {
@@ -72,7 +67,6 @@ button {
 }
 
 #app {
-
   text-align: center;
 }
 

+ 14 - 14
src/views/redirect/index.vue

@@ -1,23 +1,23 @@
 <template>
   <div />
-</template>
-
-<script lang="ts" setup>
+  </template>
+  
+  <script lang="ts" setup>
 // @ts-expect-error: 类型定义问题
-import { useRouter, useRoute } from 'vue-router';
+    import { useRouter, useRoute } from 'vue-router';
 
 // 添加组件名称
 // @ts-expect-error: 类型定义问题
 defineOptions({
   name: 'RedirectPage'
 });
-
-const router = useRouter();
-const route = useRoute();
-
-const gotoPath = route.params.path as string;
-
-router.replace({ path: gotoPath });
-</script>
-
-<style scoped lang="less"></style>
+  
+    const router = useRouter();
+    const route = useRoute();
+  
+    const gotoPath = route.params.path as string;
+  
+    router.replace({ path: gotoPath });
+  </script>
+  
+  <style scoped lang="less"></style>