create-young-proj 0.5.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. package/package.json +1 -1
  2. package/template-uni-app/.vscode/vue-html.code-snippets +14 -0
  3. package/template-uni-app/README.md +24 -1
  4. package/template-uni-app/_env +3 -1
  5. package/template-uni-app/auto-imports.d.ts +3 -0
  6. package/template-uni-app/components.d.ts +1 -4
  7. package/template-uni-app/custom-plugins/multiconf.ts +3 -4
  8. package/template-uni-app/manifest.config.ts +88 -0
  9. package/template-uni-app/package.json +7 -0
  10. package/template-uni-app/pages.config.ts +58 -0
  11. package/template-uni-app/pnpm-lock.yaml +212 -1
  12. package/template-uni-app/src/App.vue +6 -1
  13. package/template-uni-app/src/apis/index.ts +17 -3
  14. package/template-uni-app/src/components/young-loading/young-loading.vue +2 -2
  15. package/template-uni-app/src/components/young-loading-mini/young-loading-mini.vue +38 -0
  16. package/template-uni-app/src/components/young-navbar/young-navbar.vue +3 -3
  17. package/template-uni-app/src/components/young-tabbar/young-tabbar.vue +14 -10
  18. package/template-uni-app/src/config/enum.ts +4 -3
  19. package/template-uni-app/src/env.d.ts +5 -4
  20. package/template-uni-app/src/layouts/default.vue +24 -0
  21. package/template-uni-app/src/layouts/tabbar.vue +28 -0
  22. package/template-uni-app/src/manifest.json +1 -9
  23. package/template-uni-app/src/pages/demo/index.vue +24 -0
  24. package/template-uni-app/src/pages/index.vue +22 -34
  25. package/template-uni-app/src/pages/my.vue +18 -22
  26. package/template-uni-app/src/pages.json +23 -18
  27. package/template-uni-app/src/static/back.png +0 -0
  28. package/template-uni-app/src/static/h.png +0 -0
  29. package/template-uni-app/src/static/home.png +0 -0
  30. package/template-uni-app/src/static/home_active.png +0 -0
  31. package/template-uni-app/src/static/more.png +0 -0
  32. package/template-uni-app/src/static/my.png +0 -0
  33. package/template-uni-app/src/static/my_active.png +0 -0
  34. package/template-uni-app/src/static/network.png +0 -0
  35. package/template-uni-app/src/store/system.ts +10 -2
  36. package/template-uni-app/src/utils/map.ts +3 -2
  37. package/template-uni-app/src/utils/system.ts +2 -2
  38. package/template-uni-app/tsconfig.json +5 -2
  39. package/template-uni-app/vite.config.ts +20 -24
  40. package/template-uni-app/volar.config.js +6 -0
  41. package/template-uni-app/src/components/young-tabbar-layout/young-tabbar-layout.vue +0 -27
@@ -0,0 +1,38 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2023-07-20 14:48:35
4
+ * @LastEditTime: 2023-07-20 15:09:28
5
+ * @Description:
6
+ -->
7
+ <script lang="ts" setup>
8
+ withDefaults(defineProps<{
9
+ /**
10
+ * 加载中的动图
11
+ */
12
+ loadingGif?: string;
13
+ /**
14
+ * 文本提示
15
+ */
16
+ tip?: string;
17
+ }>(), {
18
+ loadingGif: 'https://api.iconify.design/eos-icons:bubble-loading.svg?color=%23e80d19',
19
+ tip: '拼命加载中...'
20
+ });
21
+
22
+ const loading = ref(false);
23
+
24
+ const start = () => loading.value = true;
25
+ const end = () => loading.value = false;
26
+
27
+ defineExpose({
28
+ start,
29
+ end
30
+ });
31
+ </script>
32
+ <template>
33
+ <view v-if="loading"
34
+ class="w100vw h100vh fixed left-0 top-0 z-999998 bg-[#333] opacity-90 flex flex-col items-center justify-center">
35
+ <image :src="loadingGif" class="w240rpx h240rpx mb-32rpx" />
36
+ <text class="text-[#fff] text-24rpx leading-36rpx">{{ tip }}</text>
37
+ </view>
38
+ </template>
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-19 09:03:51
4
- * @LastEditTime: 2023-07-19 16:47:55
4
+ * @LastEditTime: 2023-07-20 15:18:33
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -98,8 +98,8 @@ const handleLeftClick = () => {
98
98
  <slot name="back" />
99
99
  </template>
100
100
  <template v-else>
101
- <!-- <image v-if="pagesCount === 1" src="../static/home.png" class="w20px h20px"></image>
102
- <image v-else src="../static/back.png" class="w20px h20px"></image> -->
101
+ <image v-if="pagesCount === 1" src="@/static/h.png" class="w20px h20px"></image>
102
+ <image v-else src="@/static/back.png" class="w20px h20px"></image>
103
103
  </template>
104
104
  <slot name="backText" />
105
105
  </view>
@@ -1,12 +1,16 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-18 17:44:06
4
- * @LastEditTime: 2023-07-19 10:34:41
4
+ * @LastEditTime: 2023-07-20 12:03:39
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
8
8
  import { Pages } from '@/config';
9
- import { isHttpUrl } from '@bluesyoung/utils';
9
+ import home from '@/static/home.png';
10
+ import home_active from '@/static/home_active.png';
11
+ import my from '@/static/my.png';
12
+ import my_active from '@/static/my_active.png';
13
+
10
14
  type Tabbar = {
11
15
  selectedIconPath: string;
12
16
  iconPath: string;
@@ -19,14 +23,14 @@ withDefaults(defineProps<{ z?: number }>(), { z: 99 });
19
23
  const list = ref<Tabbar[]>([
20
24
  {
21
25
  text: '首页',
22
- iconPath: 'home',
23
- selectedIconPath: 'home-filled',
26
+ iconPath: home,
27
+ selectedIconPath: home_active,
24
28
  pagePath: Pages.首页
25
29
  },
26
30
  {
27
31
  text: '我的',
28
- iconPath: 'contact',
29
- selectedIconPath: 'contact-filled',
32
+ iconPath: my,
33
+ selectedIconPath: my_active,
30
34
  pagePath: Pages.个人中心
31
35
  }
32
36
  ]);
@@ -43,7 +47,9 @@ const tabChange = (index: number) => {
43
47
  return;
44
48
  }
45
49
  tabbar(list.value[index].pagePath);
46
- }
50
+ };
51
+
52
+ uni.hideTabBar();
47
53
  </script>
48
54
 
49
55
  <template>
@@ -51,9 +57,7 @@ const tabChange = (index: number) => {
51
57
  <view @click="tabChange(index)" v-for="(item, index) in list" :key="index" class="t-tabbar__item"
52
58
  :class="{ 't-bar__item_on': index === current }">
53
59
  <view style="position: relative;display:inline-block;">
54
- <image v-if="isHttpUrl(item.selectedIconPath)" :src="current === index ? item.selectedIconPath : item.iconPath"
55
- class="t-tabbar__icon"></image>
56
- <uni-icons :type="current === index ? item.selectedIconPath : item.iconPath" />
60
+ <image :src="current === index ? item.selectedIconPath : item.iconPath" class="t-tabbar__icon"></image>
57
61
  </view>
58
62
  <view class="t-tabbar__label">{{ item.text }}</view>
59
63
  </view>
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-18 14:51:02
4
- * @LastEditTime: 2023-07-19 12:17:58
4
+ * @LastEditTime: 2023-07-20 15:35:06
5
5
  * @Description:
6
6
  */
7
7
 
@@ -37,10 +37,11 @@ export enum YoungStorageKeys {
37
37
  export enum Pages {
38
38
  首页 = '/pages/index',
39
39
  个人中心 = '/pages/my',
40
+ 测试子页面 = '/pages/demo/index',
40
41
  }
41
42
  /**
42
43
  * tabbar 页面
43
44
  */
44
- export const TabbarArr = [Pages.首页, Pages.个人中心] as const;
45
+ export const TabbarArr = [Pages.首页, Pages.个人中心];
45
46
 
46
- export enum UIEvents { }
47
+ export enum UIEvents {}
@@ -1,11 +1,11 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-19 08:41:05
4
- * @LastEditTime: 2023-07-19 15:46:37
4
+ * @LastEditTime: 2023-07-20 15:05:15
5
5
  * @Description:
6
6
  */
7
7
  /// <reference types="vite/client" />
8
-
8
+ /// <reference types="@uni-helper/vite-plugin-uni-pages/client" />
9
9
  declare module '*.vue' {
10
10
  import { DefineComponent } from 'vue'
11
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
@@ -19,9 +19,10 @@ declare module '*.vue' {
19
19
  */
20
20
  declare interface ImportMetaEnv {
21
21
  /**
22
- * 公共配置
22
+ * 接口是否使用自定义 loading
23
+ * src/components/young-loading-mini/young-loading-mini.vue
23
24
  */
24
- VITE_COMMON: string;
25
+ VITE_CUSTOM_LOADING: boolean;
25
26
 
26
27
  /**
27
28
  * 微信小程序 appid
@@ -0,0 +1,24 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2023-07-20 10:55:54
4
+ * @LastEditTime: 2023-07-20 15:40:22
5
+ * @Description: todo: 默认布局,按需调整
6
+ -->
7
+ <script lang="ts" setup>
8
+ const { httpLoadingEl } = storeToRefs(useHttpLoading());
9
+ const { pagesInfo } = storeToRefs(useSystemInfo());
10
+
11
+ onLoad(() => {
12
+ const [page] = getCurrentPages();
13
+
14
+ const pageConf = pagesInfo.value.find((p) => p.path === page.route);
15
+ if (pageConf && pageConf.needLogin) {
16
+ console.log('todo: 这个页面需要登录,进行登录条件判断');
17
+ }
18
+ });
19
+ </script>
20
+
21
+ <template>
22
+ <young-loading-mini ref="httpLoadingEl" />
23
+ <slot />
24
+ </template>
@@ -0,0 +1,28 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2023-07-20 11:00:42
4
+ * @LastEditTime: 2023-07-20 15:09:18
5
+ * @Description: tabbar 页面的默认布局
6
+ -->
7
+ <script lang="ts" setup>
8
+ const { customBarH, safeBottom } = getNavbarHeihgt();
9
+ const loadingEl = ref();
10
+
11
+ const { httpLoadingEl } = storeToRefs(useHttpLoading());
12
+
13
+ onMounted(() => {
14
+ setTimeout(() => {
15
+ loadingEl.value?.end();
16
+ }, 3e3);
17
+ });
18
+ </script>
19
+ <template>
20
+ <young-loading ref="loadingEl" />
21
+ <young-loading-mini ref="httpLoadingEl" />
22
+ <div class="flex flex-col" :style="{ height: `calc(100vh - ${customBarH}px - ${safeBottom}px - 44px)` }">
23
+ <scroll-view scroll-y class="flex-1 bg-transparent">
24
+ <slot></slot>
25
+ </scroll-view>
26
+ <young-tabbar :z="999" />
27
+ </div>
28
+ </template>
@@ -5,7 +5,6 @@
5
5
  "versionName": "1.0.0",
6
6
  "versionCode": "100",
7
7
  "transformPx": false,
8
- /* 5+App特有相关 */
9
8
  "app-plus": {
10
9
  "usingComponents": true,
11
10
  "nvueStyleCompiler": "uni-app",
@@ -16,11 +15,8 @@
16
15
  "autoclose": true,
17
16
  "delay": 0
18
17
  },
19
- /* 模块配置 */
20
18
  "modules": {},
21
- /* 应用发布信息 */
22
19
  "distribute": {
23
- /* android打包配置 */
24
20
  "android": {
25
21
  "permissions": [
26
22
  "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
@@ -40,15 +36,11 @@
40
36
  "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
41
37
  ]
42
38
  },
43
- /* ios打包配置 */
44
39
  "ios": {},
45
- /* SDK配置 */
46
40
  "sdkConfigs": {}
47
41
  }
48
42
  },
49
- /* 快应用特有相关 */
50
43
  "quickapp": {},
51
- /* 小程序特有相关 */
52
44
  "mp-weixin": {
53
45
  "appid": "",
54
46
  "setting": {
@@ -80,4 +72,4 @@
80
72
  "enable": false
81
73
  },
82
74
  "vueVersion": "3"
83
- }
75
+ }
@@ -0,0 +1,24 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2023-07-20 15:13:57
4
+ * @LastEditTime: 2023-07-20 15:20:26
5
+ * @Description:
6
+ -->
7
+ <script lang="ts" setup>
8
+ const testGet = async () => {
9
+ const res = await apis.get.getByUserName('BluesYoung-web');
10
+ console.log("🚀 ~ file: index.vue:12 ~ test ~ res:", res);
11
+ };
12
+
13
+ const testPost = async () => {
14
+ await apis.post.createRepo('BluesYoung-web');
15
+ };
16
+ </script>
17
+
18
+ <template>
19
+ <young-navbar />
20
+ <h1 class="text-32">我是子页面 demo</h1>
21
+
22
+ <button @click="testGet">点我测试 Get 请求</button>
23
+ <button @click="testPost">点我测试 Post 请求</button>
24
+ </template>
@@ -1,9 +1,16 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-18 11:23:36
4
- * @LastEditTime: 2023-07-19 16:50:03
4
+ * @LastEditTime: 2023-07-20 15:24:46
5
5
  * @Description:
6
6
  -->
7
+ <route lang="json">
8
+ {
9
+ "needLogin": true,
10
+ "layout": "tabbar"
11
+ }
12
+ </route>
13
+
7
14
  <script lang="ts" setup>
8
15
  const testGet = async () => {
9
16
  const res = await apis.get.getByUserName('BluesYoung-web');
@@ -13,40 +20,21 @@ const testGet = async () => {
13
20
  const testPost = async () => {
14
21
  await apis.post.createRepo('BluesYoung-web');
15
22
  };
16
- const navBar = getNavbarHeihgt();
17
-
18
- const loadingEl = ref();
19
-
20
- onLoad(() => {
21
- uni.hideTabBar();
22
- });
23
-
24
- onMounted(() => {
25
- setTimeout(() => {
26
- loadingEl.value?.stop();
27
- }, 3e3);
28
- });
29
23
  </script>
30
24
 
31
25
  <template>
32
- <div>
33
- <young-navbar isback />
34
- <young-tabbar-layout :top="navBar.customBarH" bg="#F0F0F0">
35
- <h1 class="text-32">我是页面</h1>
36
- <view class="uni-primary">主色</view>
37
- <view class="uni-success">成功色</view>
38
- <view class="uni-warning">警告色</view>
39
- <view class="uni-error">错误色</view>
40
-
41
- <button @click="testGet">点我测试 Get 请求</button>
42
- <button @click="testPost">点我测试 Post 请求</button>
43
-
44
- <uni-card title="基础卡片" sub-title="副标题" extra="额外信息"
45
- thumbnail="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png">
46
- <text>这是一个带头像和双标题的基础卡片,此示例展示了一个完整的卡片。</text>
47
- </uni-card>
48
- </young-tabbar-layout>
49
-
50
- <young-loading ref="loadingEl" />"
51
- </div>
26
+ <young-navbar :isback="false" />
27
+ <h1 class="text-32">我是页面</h1>
28
+ <view class="uni-primary">主色</view>
29
+ <view class="uni-success">成功色</view>
30
+ <view class="uni-warning">警告色</view>
31
+ <view class="uni-error">错误色</view>
32
+
33
+ <button @click="testGet">点我测试 Get 请求</button>
34
+ <button @click="testPost">点我测试 Post 请求</button>
35
+
36
+ <uni-card title="基础卡片" sub-title="副标题" extra="额外信息"
37
+ thumbnail="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png" @click="to(Pages.测试子页面)">
38
+ <text>这是一个带头像和双标题的基础卡片,此示例展示了一个完整的卡片。</text>
39
+ </uni-card>
52
40
  </template>
@@ -1,29 +1,25 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-18 17:53:43
4
- * @LastEditTime: 2023-07-19 11:56:45
4
+ * @LastEditTime: 2023-07-20 11:56:29
5
5
  * @Description:
6
6
  -->
7
- <script lang="ts" setup>
8
- onLoad(() => {
9
- uni.hideTabBar();
10
- });
11
- </script>
12
- <template>
13
- <div>
14
- <uni-nav-bar status-bar :border="false" title="个人中心" />
15
- <young-tabbar-layout>
16
- <h1 class="text-32">我是页面</h1>
17
- <view class="uni-primary">主色</view>
18
- <view class="uni-success">成功色</view>
19
- <view class="uni-warning">警告色</view>
20
- <view class="uni-error">错误色</view>
21
-
7
+ <route lang="json">
8
+ {
9
+ "needLogin": true,
10
+ "layout": "tabbar"
11
+ }
12
+ </route>
22
13
 
23
- <uni-card title="基础卡片" sub-title="副标题" extra="额外信息"
24
- thumbnail="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png">
25
- <text>这是一个带头像和双标题的基础卡片,此示例展示了一个完整的卡片。</text>
26
- </uni-card>
27
- </young-tabbar-layout>
28
- </div>
14
+ <template>
15
+ <uni-nav-bar status-bar :border="false" title="个人中心" />
16
+ <h1 class="text-32">我是页面</h1>
17
+ <view class="uni-primary">主色</view>
18
+ <view class="uni-success">成功色</view>
19
+ <view class="uni-warning">警告色</view>
20
+ <view class="uni-error">错误色</view>
21
+ <uni-card title="基础卡片" sub-title="副标题" extra="额外信息"
22
+ thumbnail="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png">
23
+ <text>这是一个带头像和双标题的基础卡片,此示例展示了一个完整的卡片。</text>
24
+ </uni-card>
29
25
  </template>
@@ -3,36 +3,39 @@
3
3
  "pages": [
4
4
  {
5
5
  "path": "pages/index",
6
- "style": {
7
- "navigationBarTitleText": "demo",
8
- "navigationBarBackgroundColor": "#E60012",
9
- "navigationBarTextStyle": "white",
10
- "navigationStyle": "custom"
11
- }
6
+ "type": "home",
7
+ "needLogin": true,
8
+ "layout": "tabbar"
12
9
  },
13
10
  {
14
11
  "path": "pages/my",
15
- "style": {
16
- "navigationBarTitleText": "demo",
17
- "navigationBarBackgroundColor": "#E60012",
18
- "navigationBarTextStyle": "white",
19
- "navigationStyle": "custom"
20
- }
12
+ "type": "page",
13
+ "needLogin": true,
14
+ "layout": "tabbar"
15
+ },
16
+ {
17
+ "path": "pages/demo/index",
18
+ "type": "page"
21
19
  }
22
20
  ],
23
21
  "tabBar": {
24
- "color": "#7A7E83",
25
- "selectedColor": "#3cc51f",
26
- "borderStyle": "black",
22
+ "color": "#666",
23
+ "selectedColor": "#333",
24
+ "borderStyle": "white",
27
25
  "backgroundColor": "#ffffff",
26
+ "fontSize": "22rpx",
28
27
  "list": [
29
28
  {
30
29
  "pagePath": "pages/index",
31
- "text": "首页"
30
+ "text": "首页",
31
+ "iconPath": "static/home.png",
32
+ "selectedIconPath": "static/home_active.png"
32
33
  },
33
34
  {
34
35
  "pagePath": "pages/my",
35
- "text": "我的"
36
+ "text": "我的",
37
+ "iconPath": "static/my.png",
38
+ "selectedIconPath": "static/my_active.png"
36
39
  }
37
40
  ]
38
41
  },
@@ -41,6 +44,7 @@
41
44
  "navigationBarTitleText": "demo",
42
45
  "navigationBarTextStyle": "white",
43
46
  "navigationBarBackgroundColor": "#0D0D0D",
47
+ "navigationStyle": "custom",
44
48
  "backgroundColor": "#F2EAE0",
45
49
  "backgroundColorTop": "#F2EAE0",
46
50
  "backgroundColorBottom": "#F4F5F6",
@@ -59,5 +63,6 @@
59
63
  "^young-(.*)": "@/components/young-$1/young-$1.vue",
60
64
  "^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
61
65
  }
62
- }
66
+ },
67
+ "subPackages": []
63
68
  }
@@ -1,12 +1,20 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-18 15:20:04
4
- * @LastEditTime: 2023-07-18 15:20:04
4
+ * @LastEditTime: 2023-07-20 15:00:01
5
5
  * @Description:
6
6
  */
7
+ import type { PageMetaDatum } from '@uni-helper/vite-plugin-uni-pages';
7
8
  import { defineStore } from 'pinia';
8
9
 
9
10
  export const useSystemInfo = defineStore('useSystemInfo', () => {
10
11
  const systemInfo = ref<UniApp.GetSystemInfoResult>();
11
- return { systemInfo };
12
+ const pagesInfo = ref<PageMetaDatum[]>([]);
13
+
14
+ return { systemInfo, pagesInfo };
15
+ });
16
+
17
+ export const useHttpLoading = defineStore('useHttpLoading', () => {
18
+ const httpLoadingEl = ref();
19
+ return { httpLoadingEl };
12
20
  });
@@ -41,8 +41,9 @@ export const searchLoaction = (args: TxLocationSearch) => {
41
41
 
42
42
  return new Promise<TxLocationSearchRes[]>((resolve, reject): void => {
43
43
  uni.request({
44
- url: `https://apis.map.qq.com/ws/place/v1/search?boundary=nearby(${latitude},${longitude},1000)${keyword ? `&keyword=${keyword}` : ''
45
- }&page_size=${page_size}&page_index=${page_index}&key=${getMapApiKey()}`,
44
+ url: `https://apis.map.qq.com/ws/place/v1/search?boundary=nearby(${latitude},${longitude},1000)${
45
+ keyword ? `&keyword=${keyword}` : ''
46
+ }&page_size=${page_size}&page_index=${page_index}&key=${getMapApiKey()}`,
46
47
  success: (res) => {
47
48
  resolve((res.data as unknown as { data: TxLocationSearchRes[] }).data);
48
49
  },
@@ -52,12 +52,12 @@ export const getSystemInfo = () => {
52
52
  customBar = statusBar + (e.titleBarHeight || 0);
53
53
  // #endif
54
54
 
55
- const safeBottom = e.screenHeight - (e.safeArea ? (e.safeArea.height + e.safeArea.top) : 0);
55
+ const safeBottom = e.screenHeight - (e.safeArea ? e.safeArea.height + e.safeArea.top : 0);
56
56
 
57
57
  setNavbarHeihgt({
58
58
  statusBarH: statusBar,
59
59
  customBarH: customBar,
60
- safeBottom
60
+ safeBottom,
61
61
  });
62
62
  _resolve(e);
63
63
  },
@@ -7,7 +7,10 @@
7
7
  "@/*": ["./src/*"]
8
8
  },
9
9
  "lib": ["esnext", "dom"],
10
- "types": ["@dcloudio/types"]
10
+ "types": ["@dcloudio/types", "@uni-helper/uni-app-types", "@uni-helper/uni-ui-types"]
11
11
  },
12
- "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "custom-plugins/*.ts", "auto-imports.d.ts", "components.d.ts"]
12
+ "vueCompilerOptions": {
13
+ "nativeTags": ["block", "component", "template", "slot"]
14
+ },
15
+ "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "custom-plugins/*.ts", "auto-imports.d.ts", "components.d.ts", "pages.config.ts"]
13
16
  }
@@ -1,29 +1,26 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-18 11:03:01
4
- * @LastEditTime: 2023-07-19 17:50:15
4
+ * @LastEditTime: 2023-07-20 14:10:56
5
5
  * @Description:
6
6
  */
7
7
  import { resolve } from 'node:path';
8
8
  import { defineConfig } from 'vite';
9
- import type { ConfigEnv, UserConfigExport } from 'vite';
10
- import uni from '@dcloudio/vite-plugin-uni';
9
+ import type { ConfigEnv } from 'vite';
10
+ import Uni from '@dcloudio/vite-plugin-uni';
11
+ import UniPages from '@uni-helper/vite-plugin-uni-pages';
12
+ import UniLayouts from '@uni-helper/vite-plugin-uni-layouts';
13
+ import UniManifest from '@uni-helper/vite-plugin-uni-manifest';
14
+
11
15
  import Unocss from 'unocss/vite';
12
16
  import AutoImport from 'unplugin-auto-import/vite';
13
17
  import AutoComponents from 'unplugin-vue-components/vite';
14
18
  import { polyfillFormData, multiConf } from './custom-plugins';
15
19
 
16
- /**
17
- * 大驼峰转中划线
18
- */
19
- function camel2kebab(str: string) {
20
- return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
21
- };
22
-
23
20
  // https://vitejs.dev/config/
24
21
  export default ({ command, mode }: ConfigEnv) => {
25
- console.log("🚀 ~ file: vite.config.ts:18 ~ mode:", mode)
26
- console.log("🚀 ~ file: vite.config.ts:18 ~ command:", command)
22
+ console.log('🚀 ~ file: vite.config.ts:18 ~ mode:', mode);
23
+ console.log('🚀 ~ file: vite.config.ts:18 ~ command:', command);
27
24
  return defineConfig({
28
25
  resolve: {
29
26
  alias: {
@@ -36,16 +33,15 @@ export default ({ command, mode }: ConfigEnv) => {
36
33
  AutoComponents({
37
34
  dts: true,
38
35
  globs: ['src/components/**/*.vue'],
39
- resolvers: [
40
- (componentName) => {
41
- if (componentName.startsWith('Uni')) {
42
- const pkgName = camel2kebab(componentName);
43
- return { name: 'default', from: `@dcloudio/uni-ui/lib/${pkgName}/${pkgName}.vue` };
44
- }
45
- }
46
- ]
47
36
  }),
48
- uni(),
37
+
38
+ // https://uni-helper.js.org/vite-plugin-uni-pages
39
+ UniPages(),
40
+ // https://uni-helper.js.org/vite-plugin-uni-layouts
41
+ UniLayouts(),
42
+ // https://uni-helper.js.org/vite-plugin-uni-manifest
43
+ UniManifest(),
44
+ Uni(),
49
45
  // https://github.com/antfu/unocss
50
46
  Unocss(),
51
47
 
@@ -59,10 +55,10 @@ export default ({ command, mode }: ConfigEnv) => {
59
55
  resolve(__dirname, 'src/config/**'),
60
56
  resolve(__dirname, 'src/store/**'),
61
57
  resolve(__dirname, 'src/utils/**'),
62
- ]
58
+ ],
63
59
  }),
64
60
 
65
- multiConf(mode)
61
+ multiConf(mode),
66
62
  ],
67
63
  });
68
- }
64
+ };
@@ -0,0 +1,6 @@
1
+ // volar.config.js
2
+ const volarServiceUniPages = require('@uni-helper/volar-service-uni-pages');
3
+
4
+ module.exports = {
5
+ services: [volarServiceUniPages()],
6
+ };