Browse Source

refactor(路由配置): 将路由配置从json5格式统一改为jsonc格式

统一项目中的路由配置格式,从json5改为jsonc,保持一致性
移除json5特有的注释语法,使用标准json格式
更新vscode代码片段模板以匹配新的格式规范
feige996 10 months ago
parent
commit
f7154d173c

+ 5 - 5
.vscode/vue3.code-snippets

@@ -19,12 +19,12 @@
     "scope": "vue",
     "prefix": "v3",
     "body": [
-      "<route lang=\"json5\" type=\"page\">",
+      "<route lang=\"jsonc\" type=\"page\">",
       "{",
-      "  layout: 'default',",
-      "  style: {",
-      "    navigationBarTitleText: '$1',",
-      "  },",
+      "  \"layout\": \"default\",",
+      "  \"style\": {",
+      "    \"navigationBarTitleText\": \"$1\"",
+      "  }",
       "}",
       "</route>\n",
       "<script lang=\"ts\" setup>",

+ 5 - 5
src/pages-sub/demo/index.vue

@@ -1,9 +1,9 @@
-<route lang="json5" type="page">
+<route lang="jsonc" type="page">
 {
-  style: {
-    navigationStyle: 'default',
-    navigationBarTitleText: '分包页面 标题',
-  },
+  "layout": "default",
+  "style": {
+    "navigationBarTitleText": "分包页面"
+  }
 }
 </route>
 

+ 5 - 5
src/pages/about/about.vue

@@ -1,9 +1,9 @@
-<route lang="json5">
+<route lang="jsonc" type="page">
 {
-  layout: 'tabbar',
-  style: {
-    navigationBarTitleText: '关于',
-  },
+  "layout": "tabbar",
+  "style": {
+    "navigationBarTitleText": "关于"
+  }
 }
 </route>
 

+ 5 - 5
src/pages/about/alova.vue

@@ -1,9 +1,9 @@
-<route lang="json5" type="page">
+<route lang="jsonc" type="page">
 {
-  layout: 'default',
-  style: {
-    navigationBarTitleText: 'Alova 请求演示',
-  },
+  "layout": "default",
+  "style": {
+    "navigationBarTitleText": "Alova 请求演示"
+  }
 }
 </route>
 

+ 7 - 7
src/pages/index/index.vue

@@ -1,12 +1,12 @@
-<!-- 使用 type="home" 属性设置首页,其他页面不需要设置,默认为page;推荐使用json5,更强大,且允许注释 -->
-<route lang="json5" type="home">
+<!-- 使用 type="home" 属性设置首页,其他页面不需要设置,默认为page -->
+<route lang="jsonc" type="home">
 {
-  layout: 'tabbar',
-  style: {
+  "layout": "tabbar",
+  "style": {
     // 'custom' 表示开启自定义导航栏,默认 'default'
-    navigationStyle: 'custom',
-    navigationBarTitleText: '首页',
-  },
+    "navigationStyle": "custom",
+    "navigationBarTitleText": "首页"
+  }
 }
 </route>