Преглед изворни кода

build: lang="json5" 是默认值,不用写

Burt пре 2 година
родитељ
комит
a95028f608
3 измењених фајлова са 6 додато и 5 уклоњено
  1. 1 1
      .vscode/vue3.code-snippets
  2. 2 2
      src/pages/index/index.vue
  3. 3 2
      vite.config.ts

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

@@ -20,7 +20,7 @@
     "scope": "vue",
     "prefix": "v3",
     "body": [
-      "<route lang=\"json5\" type=\"page\">",
+      "<route type=\"page\">",
       "{",
       "  style: { navigationBarTitleText: '$1' },",
       "}",

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

@@ -1,5 +1,5 @@
-<!-- 使用 type="home" 属性设置首页,其他页面不需要设置,默认为page;推荐使用json5,更强大,且允许注释 -->
-<route lang="json5" type="home">
+<!-- type=home|page,默认为page。这里使用 type="home" 申明为首页,其他页面不需要设置 -->
+<route type="home">
 {
   style: {
     navigationStyle: 'custom',

+ 3 - 2
vite.config.ts

@@ -50,8 +50,9 @@ export default ({ command, mode }) => {
     plugins: [
       UniPages({
         exclude: ['**/components/**/**.*'],
-        homePage: 'pages/index/index',
-        subPackages: ['src/pages-sub'],
+        // routeBlockLang: 'json5',
+        // homePage: 'pages/index/index',
+        subPackages: ['src/pages-sub'], // 是一个数组,可以设置多个
       }),
       UniLayouts(),
       UniPlatform(),