create-young-proj 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,10 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-05-25 19:53:07
4
- * @LastEditTime: 2023-10-27 16:31:29
4
+ * @LastEditTime: 2024-06-17 12:02:16
5
5
  * @Description:
6
6
  -->
7
+
7
8
  <script lang="ts" setup>
8
9
  import '@unocss/reset/tailwind-compat.css'
9
10
 
@@ -18,6 +19,49 @@ app.hook('page:start', () => {
18
19
  app.hook('page:finish', () => {
19
20
  // console.log('loading end ...')
20
21
  hideLoading()
22
+
23
+ /**
24
+ * ua: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0
25
+ * 解析出版本号 120.0.0.0
26
+ * todo: 按需调整版本号
27
+ */
28
+ const ua = navigator.userAgent
29
+
30
+ const version = ua.match(/Chrome\/(\d+)\./)?.[1] ?? ''
31
+
32
+ // 旧版浏览器
33
+ if (version && Number.parseInt(version) < 63) {
34
+ console.warn('浏览器版本过低,可能会出问题')
35
+ showConfirmDialog({
36
+ title: '温馨提示',
37
+ message:
38
+ '当前浏览器版本过低,可能会导致部分功能无法正常使用,建议您升级到最新版本的浏览器。',
39
+ confirmButtonText: '立即升级',
40
+ cancelButtonText: '仍要使用',
41
+ cancelButtonColor: 'red',
42
+ })
43
+ .then(() => {
44
+ location.href = 'https://support.dmeng.net/upgrade-your-browser.html'
45
+ })
46
+ .catch(() => {
47
+ // on cancel
48
+ // todo: 记住选项,不再弹窗
49
+ console.log('用户选择继续使用')
50
+ })
51
+ }
52
+ else if (
53
+ (/Alipay/i.test(ua) && /\(iPhone|iPod|iPad\)/i.test(ua))
54
+ || (/QQ\//i.test(ua) && /\(iPhone|iPod|iPad\)/i.test(ua))
55
+ ) {
56
+ // ios:
57
+ // 支付宝内置浏览器
58
+ // QQ 内置浏览器
59
+ console.warn('ios alipay/qq, has useFetch 400 problem, please use native app')
60
+ showConfirmDialog({
61
+ title: '温馨提示',
62
+ message: '当前环境访问受限,可能会导致部分功能无法正常使用,建议您使用系统自带浏览器访问',
63
+ }).catch(() => null)
64
+ }
21
65
  })
22
66
  </script>
23
67
 
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-09-27 14:15:48
4
- * @LastEditTime: 2023-11-08 09:26:21
4
+ * @LastEditTime: 2024-06-14 17:30:20
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -60,21 +60,23 @@ const bgColor = computed(() => (route.meta.bgColor as string) || '#fff')
60
60
  </script>
61
61
 
62
62
  <template>
63
- <!-- PC 顶部导航栏 & 移动端首页导航栏 -->
64
- <YoungHeader lt-md="!hidden" />
65
- <!-- 移动端其他页面导航 -->
66
- <MobileNavBar v-if="$route.meta.name" :title="$route.meta.name" />
63
+ <div>
64
+ <!-- PC 顶部导航栏 & 移动端首页导航栏 -->
65
+ <YoungHeader lt-md="!hidden" />
66
+ <!-- 移动端其他页面导航 -->
67
+ <MobileNavBar v-if="$route.meta.name" :title="$route.meta.name" />
67
68
 
68
- <main
69
- class="m-auto" :class="[showAd ? 'mt-160px min-h-[calc(100vh-160px)] lt-md:mt-80px lt-md:min-h-[calc(100vh-80px)]' : 'mt-80px min-h-[calc(100vh-80px)] lt-md:mt-44px min-h-[calc(100vh-44px)]']" :style="{
70
- backgroundColor: bgColor,
71
- }"
72
- >
73
- <div class="m-auto" lt-md="px-10px" :class="[isFull ? 'w-full' : 'container']">
74
- <NuxtPage />
75
- </div>
76
- </main>
69
+ <main
70
+ class="m-auto" :class="[showAd ? 'mt-160px min-h-[calc(100vh-160px)] lt-md:mt-80px lt-md:min-h-[calc(100vh-80px)]' : 'mt-80px min-h-[calc(100vh-80px)] lt-md:mt-44px min-h-[calc(100vh-44px)]']" :style="{
71
+ backgroundColor: bgColor,
72
+ }"
73
+ >
74
+ <div class="m-auto" lt-md="px-10px" :class="[isFull ? 'w-full' : 'container']">
75
+ <NuxtPage />
76
+ </div>
77
+ </main>
77
78
 
78
- <!-- 底部 -->
79
- <LazyYoungFooter lt-md="!hidden" />
79
+ <!-- 底部 -->
80
+ <LazyYoungFooter lt-md="!hidden" />
81
+ </div>
80
82
  </template>
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-10-11 17:30:55
4
- * @LastEditTime: 2023-11-08 10:56:14
4
+ * @LastEditTime: 2024-06-14 17:19:56
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -59,17 +59,19 @@ const isFull = computed(() => route.query.full || route.meta.full)
59
59
  </script>
60
60
 
61
61
  <template>
62
- <!-- PC 顶部导航栏 & 移动端首页导航栏 -->
63
- <YoungHeader />
62
+ <div>
63
+ <!-- PC 顶部导航栏 & 移动端首页导航栏 -->
64
+ <YoungHeader />
64
65
 
65
- <main class="m-auto" :class="[showAd ? 'mt-160px min-h-[calc(100vh-160px)] lt-md:mt-80px lt-md:min-h-[calc(100vh-80px)]' : 'mt-80px min-h-[calc(100vh-80px)] lt-md:mt-44px min-h-[calc(100vh-44px)]']">
66
- <div class="m-auto" lt-md="px-10px" :class="[isFull ? 'w-full' : 'container']">
67
- <NuxtPage />
68
- </div>
69
- </main>
66
+ <main class="m-auto" :class="[showAd ? 'mt-160px min-h-[calc(100vh-160px)] lt-md:mt-80px lt-md:min-h-[calc(100vh-80px)]' : 'mt-80px min-h-[calc(100vh-80px)] lt-md:mt-44px min-h-[calc(100vh-44px)]']">
67
+ <div class="m-auto" lt-md="px-10px" :class="[isFull ? 'w-full' : 'container']">
68
+ <NuxtPage />
69
+ </div>
70
+ </main>
70
71
 
71
- <!-- 底部 -->
72
- <LazyYoungFooter />
73
- <!-- 移动端 tabbar -->
74
- <LazyYoungTabbar />
72
+ <!-- 底部 -->
73
+ <LazyYoungFooter />
74
+ <!-- 移动端 tabbar -->
75
+ <LazyYoungTabbar />
76
+ </div>
75
77
  </template>
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-10-16 14:15:51
4
- * @LastEditTime: 2023-11-08 10:56:34
4
+ * @LastEditTime: 2024-06-14 17:29:19
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -59,20 +59,22 @@ const bgColor = computed(() => (route.meta.bgColor as string) || '#fff')
59
59
  </script>
60
60
 
61
61
  <template>
62
- <!-- PC 顶部导航栏 & 移动端首页导航栏 -->
63
- <YoungHeader lt-md="!hidden" />
64
- <main
65
- class="m-auto mt-80px min-h-[calc(100vh-80px)] lt-md:mt-0 min-h-100vh" :style="{
66
- backgroundColor: bgColor,
67
- }"
68
- >
69
- <div class="m-auto" lt-md="px-10px" :class="[isFull ? 'w-full' : 'container']">
70
- <NuxtPage />
71
- </div>
72
- </main>
62
+ <div>
63
+ <!-- PC 顶部导航栏 & 移动端首页导航栏 -->
64
+ <YoungHeader lt-md="!hidden" />
65
+ <main
66
+ class="m-auto mt-80px min-h-[calc(100vh-80px)] lt-md:mt-0 min-h-100vh" :style="{
67
+ backgroundColor: bgColor,
68
+ }"
69
+ >
70
+ <div class="m-auto" lt-md="px-10px" :class="[isFull ? 'w-full' : 'container']">
71
+ <NuxtPage />
72
+ </div>
73
+ </main>
73
74
 
74
- <!-- 底部 -->
75
- <LazyYoungFooter lt-md="!hidden" />
76
- <!-- 移动端 tabbar -->
77
- <LazyYoungTabbar />
75
+ <!-- 底部 -->
76
+ <LazyYoungFooter lt-md="!hidden" />
77
+ <!-- 移动端 tabbar -->
78
+ <LazyYoungTabbar />
79
+ </div>
78
80
  </template>
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-09-21 15:57:55
4
- * @LastEditTime: 2023-11-30 11:05:04
4
+ * @LastEditTime: 2024-06-17 12:00:53
5
5
  * @Description:
6
6
  */
7
7
  import { resolve } from 'node:path'
@@ -21,7 +21,7 @@ export default defineNuxtConfig({
21
21
  { name: 'renderer', content: 'webkit' },
22
22
  { name: 'mobile-web-app-capable', content: 'yes' },
23
23
  { name: 'creator', content: 'BluesYoung-web' },
24
- { 'http-equiv': 'X-UA-Compatible', 'content': 'IE=edge,chrome=1' },
24
+ { 'http-equiv': 'x-ua-compatible', 'content': 'IE=edge,chrome=1' },
25
25
  { id: 'viewportMeta', name: 'viewport', content: 'maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0' },
26
26
  { name: 'format-detection', content: 'telephone=no,email=no,date=no,address=no' },
27
27
  ],
@@ -45,6 +45,11 @@ export default defineNuxtConfig({
45
45
  }
46
46
  `,
47
47
  },
48
+ // ! 必须在这里导入,ResizeObserver 写在 additionalLegacyPolyfills 里面不生效
49
+ // ? 基于 polyfill.io 按需导入
50
+ {
51
+ src: '//cdn.polyfill.io/v3/polyfill.min.js?features=ResizeObserver%2CElement.prototype.getAttributeNames',
52
+ },
48
53
  ],
49
54
  link: [
50
55
  { rel: 'icon', type: 'image/png', href: '/favicon.ico' },
@@ -59,6 +64,7 @@ export default defineNuxtConfig({
59
64
  },
60
65
  'devtools': { enabled: false },
61
66
  'modules': [
67
+ 'nuxt-vite-legacy',
62
68
  'nuxt-swiper',
63
69
  '@nuxtjs/device',
64
70
  '@pinia/nuxt',
@@ -95,12 +101,17 @@ export default defineNuxtConfig({
95
101
  '*': { swr: true },
96
102
  },
97
103
 
104
+ // 兼容旧浏览器
105
+ // Optionally, provide @vitejs/plugin-legacy options.
106
+ // For example, for Chrome 49 you could use:
107
+ 'legacy': {
108
+ targets: ['chrome 49'],
109
+ },
110
+
98
111
  'vite': {
99
112
  build: {
100
113
  sourcemap: false,
101
- // 兼容旧浏览器
102
- target: ['chrome58'],
103
- cssTarget: ['chrome58'],
114
+ cssTarget: ['chrome49'],
104
115
  },
105
116
  },
106
117
  'runtimeConfig': {
@@ -111,4 +122,8 @@ export default defineNuxtConfig({
111
122
  cacheTime: 10,
112
123
  },
113
124
  },
125
+
126
+ 'experimental': {
127
+ appManifest: false,
128
+ },
114
129
  })
@@ -32,8 +32,9 @@
32
32
  "@vueuse/nuxt": "^10.5.0",
33
33
  "element-plus": "^2.3.14",
34
34
  "eslint": "^8.51.0",
35
- "nuxt": "3.5.1",
35
+ "nuxt": "^3.12.2",
36
36
  "nuxt-swiper": "^1.2.2",
37
+ "nuxt-vite-legacy": "^1.2.0",
37
38
  "sass": "^1.69.5",
38
39
  "typescript": "^5.2.2",
39
40
  "vant": "^4.7.3"