af-mobile-client-vue3 1.1.52 → 1.2.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.
Files changed (71) hide show
  1. package/.env +4 -1
  2. package/.node-version +1 -0
  3. package/.vscode/extensions.json +6 -1
  4. package/.vscode/settings.json +32 -27
  5. package/build/vite/index.ts +29 -29
  6. package/build/vite/optimize.ts +34 -0
  7. package/build/vite/vconsole.ts +5 -2
  8. package/commitlint.config.ts +32 -0
  9. package/eslint.config.ts +30 -0
  10. package/index.html +15 -9
  11. package/mock/data.ts +15 -15
  12. package/mock/index.ts +2 -0
  13. package/mock/modules/prose.mock.ts +5 -8
  14. package/mock/util.ts +19 -0
  15. package/netlify.toml +2 -2
  16. package/package.json +66 -66
  17. package/postcss.config.ts +27 -0
  18. package/public/favicon.ico +0 -0
  19. package/public/pwa-192x192.png +0 -0
  20. package/public/pwa-512x512.png +0 -0
  21. package/public/safari-pinned-tab.svg +3 -31
  22. package/src/App.vue +45 -7
  23. package/src/components/core/ImageUploader/index.vue +159 -159
  24. package/src/components/core/NavBar/index.vue +33 -2
  25. package/src/components/core/Tabbar/index.vue +17 -25
  26. package/src/components/data/XBadge/index.vue +4 -9
  27. package/src/components/data/XCellDetail/index.vue +0 -1
  28. package/src/components/data/XCellList/index.vue +2 -1
  29. package/src/components/data/XForm/index.vue +1 -1
  30. package/src/components/data/XFormItem/index.vue +1 -0
  31. package/src/components/data/XOlMap/XLocationPicker/index.vue +1 -1
  32. package/src/components/data/XOlMap/utils/wgs84ToGcj02.js +154 -154
  33. package/src/composables/dark.ts +5 -0
  34. package/src/config/routes.ts +5 -0
  35. package/src/layout/PageLayout.vue +1 -43
  36. package/src/locales/en-US.json +81 -2
  37. package/src/locales/zh-CN.json +81 -2
  38. package/src/main.ts +6 -6
  39. package/src/router/index.ts +13 -39
  40. package/src/router/routes.ts +6 -4
  41. package/src/stores/index.ts +4 -0
  42. package/src/stores/modules/user.ts +11 -10
  43. package/src/styles/app.less +16 -57
  44. package/src/styles/login.less +22 -8
  45. package/src/styles/var.less +16 -0
  46. package/src/{vue-router.d.ts → types/vue-router.d.ts} +2 -0
  47. package/src/utils/i18n.ts +72 -41
  48. package/src/utils/inline-px-to-vw.ts +28 -0
  49. package/src/utils/set-page-title.ts +1 -1
  50. package/src/views/component/XCellListView/index.vue +96 -13
  51. package/src/views/component/XFormGroupView/index.vue +39 -2
  52. package/src/views/component/XFormView/index.vue +9 -30
  53. package/src/views/component/XOlMapView/XLocationPicker/index.vue +118 -118
  54. package/src/views/component/index.vue +36 -6
  55. package/src/views/user/login/LoginForm.vue +6 -6
  56. package/src/views/user/login/LoginTitle.vue +14 -6
  57. package/src/views/user/my/index.vue +17 -14
  58. package/tsconfig.json +0 -1
  59. package/uno.config.ts +39 -24
  60. package/vite.config.ts +7 -29
  61. package/.husky/commit-msg +0 -1
  62. package/.husky/pre-commit +0 -1
  63. package/LICENSE +0 -21
  64. package/eslint.config.js +0 -15
  65. package/mock/modules/demo.mock.ts +0 -20
  66. package/src/components.d.ts +0 -53
  67. package/src/stores/modules/routeTransitionName.ts +0 -26
  68. package/src/typing.ts +0 -3
  69. package/src/views/component/XFormView/oldindex.vue +0 -70
  70. /package/src/{env.d.ts → types/env.d.ts} +0 -0
  71. /package/src/{settings.ts → types/settings.ts} +0 -0
@@ -3,46 +3,25 @@ import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
3
3
  import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
4
  import { ref } from 'vue'
5
5
 
6
- // const configName = ref('AddConstructionForm')
7
- const configName = ref('PointBindingForm') // 点位绑定
6
+ const configName = ref('AddConstructionForm')
8
7
  const serviceName = ref('af-linepatrol')
9
8
 
10
9
  const formGroupAddConstruction = ref(null)
11
-
12
- const formData = ref({
13
- t1_f_number: 'name',
14
- f_region_id: '5',
15
- t1_f_address: '龙首原',
16
- t1_f_address_lon_lat: '108.948016,34.292333',
17
- t1_f_describe: 't1_f_describe',
18
- t1_f_state: 't1_f_state',
19
- f_points_devices: '' as string,
20
- f_brand: null as number,
21
- })
22
-
23
- function submit(result) {
24
- console.log('>>>> form result: ', result)
25
- }
26
10
  </script>
11
+
27
12
  <template>
28
13
  <NormalDataLayout id="XFormGroupView" title="纯表单">
29
14
  <template #layout_content>
30
- <div class="form">
31
- <XForm
32
- ref="formGroupAddConstruction"
33
- mode="新增"
34
- :form-data="formData"
35
- :config-name="configName"
36
- :service-name="serviceName"
37
- @on-submit="submit"
38
- />
39
- </div>
15
+ <XForm
16
+ ref="formGroupAddConstruction"
17
+ mode="新增"
18
+ :config-name="configName"
19
+ :service-name="serviceName"
20
+ />
40
21
  </template>
41
22
  </NormalDataLayout>
42
23
  </template>
43
24
 
44
25
  <style scoped lang="less">
45
- .form {
46
- margin-top: 2px;
47
- }
26
+
48
27
  </style>
@@ -1,118 +1,118 @@
1
- <script setup lang="ts">
2
- import type { LocationResult } from '@af-mobile-client-vue3/components/data/XOlMap/types'
3
- import LocationPicker from '@af-mobile-client-vue3/components/data/XOlMap/XLocationPicker/index.vue'
4
- import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
5
- import { showNotify } from 'vant'
6
- import { ref } from 'vue'
7
-
8
- const selectedLocation = ref<LocationResult>()
9
-
10
- // 处理位置选择
11
- function handleLocationConfirm(location: LocationResult) {
12
- // console.log('选择的位置:', location)
13
- // selectedLocation.value = location
14
- showNotify({ type: 'success', message: '位置已选择' })
15
- }
16
- </script>
17
-
18
- <template>
19
- <NormalDataLayout id="XLocationPicker" title="XOlMap地址选择器">
20
- <template #layout_content>
21
- <div class="location-picker-demo">
22
- <!-- 页面标题 -->
23
- <div class="page-header">
24
- <div class="title">
25
- 位置选择
26
- </div>
27
- </div>
28
-
29
- <!-- 选择结果展示 -->
30
- <div v-if="selectedLocation" class="location-result">
31
- <div class="label">
32
- 已选位置:
33
- </div>
34
- <div class="value">
35
- {{ selectedLocation.address }}
36
- </div>
37
- <div class="coordinates">
38
- 经度: {{ selectedLocation.longitude.toFixed(6) }},
39
- 纬度: {{ selectedLocation.latitude.toFixed(6) }}
40
- </div>
41
- </div>
42
-
43
- <!-- 地图组件 -->
44
- <div class="map-container">
45
- <LocationPicker
46
- v-model="selectedLocation"
47
- :default-center="[108.948024, 34.263161]"
48
- :default-zoom="12"
49
- @confirm="handleLocationConfirm"
50
- />
51
- </div>
52
- </div>
53
- </template>
54
- </NormalDataLayout>
55
- </template>
56
-
57
- <style scoped lang="less">
58
- .location-picker-demo {
59
- width: 100%;
60
- height: 100%;
61
- position: relative;
62
- display: flex;
63
- flex-direction: column;
64
- background-color: #f7f8fa;
65
- }
66
-
67
- .page-header {
68
- height: 44px;
69
- display: flex;
70
- align-items: center;
71
- justify-content: center;
72
- background: white;
73
- box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
74
- position: relative;
75
- z-index: 1;
76
-
77
- .title {
78
- font-size: 16px;
79
- color: #333;
80
- font-weight: 500;
81
- }
82
- }
83
-
84
- .location-result {
85
- background: white;
86
- padding: 12px 16px;
87
- margin: 10px;
88
- border-radius: 8px;
89
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
90
-
91
- .label {
92
- font-size: 14px;
93
- color: #666;
94
- margin-bottom: 4px;
95
- }
96
-
97
- .value {
98
- font-size: 16px;
99
- color: #333;
100
- margin-bottom: 8px;
101
- word-break: break-all;
102
- }
103
-
104
- .coordinates {
105
- font-size: 12px;
106
- color: #999;
107
- }
108
- }
109
-
110
- .map-container {
111
- flex: 1;
112
- position: relative;
113
- margin: 0 10px 10px 10px;
114
- border-radius: 8px;
115
- overflow: hidden;
116
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
117
- }
118
- </style>
1
+ <script setup lang="ts">
2
+ import type { LocationResult } from '@af-mobile-client-vue3/components/data/XOlMap/types'
3
+ import LocationPicker from '@af-mobile-client-vue3/components/data/XOlMap/XLocationPicker/index.vue'
4
+ import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
5
+ import { showNotify } from 'vant'
6
+ import { ref } from 'vue'
7
+
8
+ const selectedLocation = ref<LocationResult>()
9
+
10
+ // 处理位置选择
11
+ function handleLocationConfirm(location: LocationResult) {
12
+ // console.log('选择的位置:', location)
13
+ // selectedLocation.value = location
14
+ showNotify({ type: 'success', message: '位置已选择' })
15
+ }
16
+ </script>
17
+
18
+ <template>
19
+ <NormalDataLayout id="XLocationPicker" title="XOlMap地址选择器">
20
+ <template #layout_content>
21
+ <div class="location-picker-demo">
22
+ <!-- 页面标题 -->
23
+ <div class="page-header">
24
+ <div class="title">
25
+ 位置选择
26
+ </div>
27
+ </div>
28
+
29
+ <!-- 选择结果展示 -->
30
+ <div v-if="selectedLocation" class="location-result">
31
+ <div class="label">
32
+ 已选位置:
33
+ </div>
34
+ <div class="value">
35
+ {{ selectedLocation.address }}
36
+ </div>
37
+ <div class="coordinates">
38
+ 经度: {{ selectedLocation.longitude.toFixed(6) }},
39
+ 纬度: {{ selectedLocation.latitude.toFixed(6) }}
40
+ </div>
41
+ </div>
42
+
43
+ <!-- 地图组件 -->
44
+ <div class="map-container">
45
+ <LocationPicker
46
+ v-model="selectedLocation"
47
+ :default-center="[108.948024, 34.263161]"
48
+ :default-zoom="12"
49
+ @confirm="handleLocationConfirm"
50
+ />
51
+ </div>
52
+ </div>
53
+ </template>
54
+ </NormalDataLayout>
55
+ </template>
56
+
57
+ <style scoped lang="less">
58
+ .location-picker-demo {
59
+ width: 100%;
60
+ height: 100%;
61
+ position: relative;
62
+ display: flex;
63
+ flex-direction: column;
64
+ background-color: #f7f8fa;
65
+ }
66
+
67
+ .page-header {
68
+ height: 44px;
69
+ display: flex;
70
+ align-items: center;
71
+ justify-content: center;
72
+ background: white;
73
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
74
+ position: relative;
75
+ z-index: 1;
76
+
77
+ .title {
78
+ font-size: 16px;
79
+ color: #333;
80
+ font-weight: 500;
81
+ }
82
+ }
83
+
84
+ .location-result {
85
+ background: white;
86
+ padding: 12px 16px;
87
+ margin: 10px;
88
+ border-radius: 8px;
89
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
90
+
91
+ .label {
92
+ font-size: 14px;
93
+ color: #666;
94
+ margin-bottom: 4px;
95
+ }
96
+
97
+ .value {
98
+ font-size: 16px;
99
+ color: #333;
100
+ margin-bottom: 8px;
101
+ word-break: break-all;
102
+ }
103
+
104
+ .coordinates {
105
+ font-size: 12px;
106
+ color: #999;
107
+ }
108
+ }
109
+
110
+ .map-container {
111
+ flex: 1;
112
+ position: relative;
113
+ margin: 0 10px 10px 10px;
114
+ border-radius: 8px;
115
+ overflow: hidden;
116
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
117
+ }
118
+ </style>
@@ -1,12 +1,19 @@
1
1
  <script setup lang="ts">
2
+ import { isDark, toggleDark } from '@af-mobile-client-vue3/composables/dark'
2
3
  import useUserStore from '@af-mobile-client-vue3/stores/modules/user'
3
4
  import { indexedDB } from '@af-mobile-client-vue3/utils/indexedDB'
4
5
  import {
5
6
  showToast,
6
7
  Cell as VanCell,
7
8
  List as VanList,
9
+ Switch as VanSwitch,
8
10
  } from 'vant'
9
- import { ref } from 'vue'
11
+ import { computed, ref } from 'vue'
12
+
13
+ const checked = computed({
14
+ get: () => isDark.value,
15
+ set: () => toggleDark(),
16
+ })
10
17
 
11
18
  // 列表详情页的路由 '/Component/XCellDetailView/:id'
12
19
  const list = ref([
@@ -89,6 +96,16 @@ async function logout() {
89
96
  </h1>
90
97
  <span class="home_desc">基于Vant4的移动端组件库扩展</span>
91
98
  <div class="home_component_main">
99
+ <span class="home_desc">设置项</span>
100
+ <VanCell center title="暗黑模式">
101
+ <template #right-icon>
102
+ <VanSwitch
103
+ v-model="checked"
104
+ size="20px"
105
+ aria-label="on/off Dark Mode"
106
+ />
107
+ </template>
108
+ </VanCell>
92
109
  <span class="home_desc">配置化组件</span>
93
110
  <VanList>
94
111
  <VanCell v-for="item in list" :key="item.name" :title="item.name" is-link :to="item.to" />
@@ -103,17 +120,31 @@ async function logout() {
103
120
  </template>
104
121
 
105
122
  <style scoped lang="less">
123
+ .van-theme-light {
124
+ .home_main {
125
+ .home_title {
126
+ color: #323233;
127
+ }
128
+ .home_desc {
129
+ color: #969799;
130
+ }
131
+ .home_component_main {
132
+ .van-cell {
133
+ color: #34495e;
134
+ }
135
+ }
136
+ }
137
+ }
106
138
  .home_main {
107
- width: 100vw;
108
- height: 100%;
109
139
  padding: var(--base-interval-2);
110
- background-color: #eff2f5;
111
140
  .home_title {
141
+ display: flex;
142
+ align-items: center;
112
143
  margin: 0 0 10px;
113
144
  font-size: 30px;
114
145
  font-weight: 400;
115
- color: rgb(50, 50, 51);
116
146
  img {
147
+ display: inline-block;
117
148
  vertical-align: middle;
118
149
  width: 46px;
119
150
  height: 46px;
@@ -136,7 +167,6 @@ async function logout() {
136
167
  margin: 10px 0;
137
168
  font-weight: 600;
138
169
  border-radius: 99px;
139
- color: #34495e;
140
170
  :deep(.van-icon) {
141
171
  display: flex;
142
172
  align-items: center;
@@ -69,7 +69,7 @@ onBeforeMount(async () => {
69
69
  }
70
70
  userState.setLogin(loginInfo)
71
71
  userState.setTenantName(route.query.state)
72
- afterGeneral(data.resources)
72
+ await afterGeneral(data.resources)
73
73
 
74
74
  const toPath = decodeURIComponent((route.query?.redirect || '/') as string)
75
75
  closeToast()
@@ -118,12 +118,12 @@ function handleSubmit() {
118
118
  userState.setLogin(loginInfo)
119
119
  const compatible = import.meta.env.VITE_APP_COMPATIBLE
120
120
  if (compatible === 'OA')
121
- afterGeneral(data)
121
+ await afterGeneral(data)
122
122
  else
123
123
  if (data.resources.data)
124
- afterGeneral(data.resources.data)
124
+ await afterGeneral(data.resources.data)
125
125
  else
126
- afterGeneral(data.resources)
126
+ await afterGeneral(data.resources)
127
127
 
128
128
  const toPath = decodeURIComponent((route.query?.redirect || '/') as string)
129
129
  closeToast()
@@ -199,7 +199,7 @@ onMounted(() => {})
199
199
  </VanLoading>
200
200
  </VanRow>
201
201
  </div>
202
- <div v-if="getShow && !wxloading" class="form login_form">
202
+ <div v-if="getShow && !wxloading" class="login_form form">
203
203
  <VanForm ref="formRef" @submit="handleSubmit">
204
204
  <VanField
205
205
  v-model="formData.username"
@@ -246,5 +246,5 @@ onMounted(() => {})
246
246
  </template>
247
247
 
248
248
  <style scoped lang="less">
249
- @import "@af-mobile-client-vue3/styles/login.less";
249
+ @import '@af-mobile-client-vue3/styles/login.less';
250
250
  </style>
@@ -28,12 +28,22 @@ function getAssetsImages(logo) {
28
28
  </template>
29
29
 
30
30
  <style scoped lang="less">
31
+ html:not(.dark) {
32
+ .login_title {
33
+ background-image: url('@af-mobile-client-vue3/assets/img/user/login/background-shadow-1.svg');
34
+ background-repeat: no-repeat;
35
+ background-size: cover;
36
+ background-position: center center;
37
+ }
38
+ .title_content {
39
+ color: rgb(83, 88, 110);
40
+ .login_description {
41
+ color: var(--van-text-color-3);
42
+ }
43
+ }
44
+ }
31
45
  .login_title {
32
46
  width: 100%;
33
- background-image: url('@af-mobile-client-vue3/assets/img/user/login/background-shadow-1.svg');
34
- background-repeat: no-repeat;
35
- background-size: cover;
36
- background-position: center center;
37
47
  text-align: center;
38
48
  .login_logo {
39
49
  display: flex;
@@ -52,13 +62,11 @@ function getAssetsImages(logo) {
52
62
  }
53
63
  }
54
64
  .title_content {
55
- color: rgb(83, 88, 110);
56
65
  font-size: 26px;
57
66
  font-weight: 600;
58
67
  line-height: 26px;
59
68
  .login_description {
60
69
  margin-top: 13px;
61
- color: var(--van-text-color-3);
62
70
  font-size: 16px;
63
71
  font-weight: 400;
64
72
  line-height: 16px;
@@ -1,12 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  import useUserStore from '@af-mobile-client-vue3/stores/modules/user'
3
3
  import {
4
+ Cell as VanCell,
4
5
  Col as VanCol,
6
+ List as VanList,
5
7
  Row as VanRow,
6
8
  } from 'vant/es'
7
9
 
8
10
  const username = useUserStore().getUserInfo().name
9
- const fullnames = useUserStore().getLogin().f.resources.data.fullnames
11
+ const fullnames = useUserStore().getLogin().f.resources.parentname
10
12
 
11
13
  async function exit_login() {
12
14
  await useUserStore().logout()
@@ -71,8 +73,8 @@ async function exit_login() {
71
73
  </VanRow>
72
74
  </div>
73
75
  <div class="setting">
74
- <van-list>
75
- <van-cell is-link @click="exit_login">
76
+ <VanList>
77
+ <VanCell is-link @click="exit_login">
76
78
  <template #title>
77
79
  <VanRow :gutter="12" class="setting_row">
78
80
  <VanCol>
@@ -86,8 +88,8 @@ async function exit_login() {
86
88
  <template #right-icon>
87
89
  <img alt="setting_arrow_icon" class="setting_arrow_icon" src="../../../assets/img/user/my/setting-arrow.png">
88
90
  </template>
89
- </van-cell>
90
- </van-list>
91
+ </VanCell>
92
+ </VanList>
91
93
  </div>
92
94
  </div>
93
95
  </main>
@@ -98,7 +100,7 @@ async function exit_login() {
98
100
  .header {
99
101
  position: relative;
100
102
  height: 200px;
101
- background-color: #336BF1;
103
+ background-color: #336bf1;
102
104
  overflow: hidden;
103
105
  .style_back {
104
106
  .circle {
@@ -106,7 +108,7 @@ async function exit_login() {
106
108
  border-radius: 50%;
107
109
  }
108
110
  .circle1 {
109
- background-color: #3F7AFA;
111
+ background-color: #3f7afa;
110
112
  width: 265px;
111
113
  height: 265px;
112
114
  top: -80px;
@@ -114,7 +116,7 @@ async function exit_login() {
114
116
  z-index: 3;
115
117
  }
116
118
  .circle2 {
117
- background-color: #3C75F9;
119
+ background-color: #3c75f9;
118
120
  width: 300px;
119
121
  height: 300px;
120
122
  top: -80px;
@@ -145,8 +147,9 @@ async function exit_login() {
145
147
  border-radius: 50%;
146
148
  width: 76px;
147
149
  height: 76px;
148
- box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05),
149
- 0 6px 6px rgba(0, 0, 0, 0.05);
150
+ box-shadow:
151
+ 0 10px 20px rgba(0, 0, 0, 0.05),
152
+ 0 6px 6px rgba(0, 0, 0, 0.05);
150
153
  }
151
154
  .van-row {
152
155
  flex-wrap: nowrap;
@@ -157,7 +160,7 @@ async function exit_login() {
157
160
  margin: 0;
158
161
  }
159
162
  .user_nickname {
160
- font-size: 24px;
163
+ font-size: 20px;
161
164
  font-weight: bold;
162
165
  margin-bottom: 4px;
163
166
  }
@@ -168,7 +171,6 @@ async function exit_login() {
168
171
  }
169
172
  }
170
173
  }
171
-
172
174
  }
173
175
  .content {
174
176
  padding: var(--base-interval-1);
@@ -180,8 +182,9 @@ async function exit_login() {
180
182
  z-index: 4;
181
183
  margin: 0 16px;
182
184
  border-radius: 4px;
183
- box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05),
184
- 0 6px 6px rgba(0, 0, 0, 0.05);
185
+ box-shadow:
186
+ 0 10px 20px rgba(0, 0, 0, 0.05),
187
+ 0 6px 6px rgba(0, 0, 0, 0.05);
185
188
  .core_row {
186
189
  text-align: center;
187
190
  .van-col {
package/tsconfig.json CHANGED
@@ -13,7 +13,6 @@
13
13
  "types": [
14
14
  "node",
15
15
  "unplugin-vue-router/client",
16
- "vite-plugin-vue-layouts/client",
17
16
  "vite-plugin-pwa/client"
18
17
  ],
19
18
  "allowJs": true,
package/uno.config.ts CHANGED
@@ -1,32 +1,47 @@
1
- import presetRemToPx from '@unocss/preset-rem-to-px'
2
- import { defineConfig, presetAttributify, presetMini, presetUno } from 'unocss'
1
+ import { createRemToPxProcessor } from '@unocss/preset-wind4/utils'
3
2
 
4
- // 刚使用unocss的朋友,可以借助这个工具: https://to-unocss.netlify.app
3
+ import {
4
+ defineConfig,
5
+ presetAttributify,
6
+ presetIcons,
7
+ presetWind4,
8
+ transformerDirectives,
9
+ transformerVariantGroup,
10
+ } from 'unocss'
11
+
12
+ const BASE_FONT_SIZE = 4
5
13
 
6
14
  export default defineConfig({
15
+ shortcuts: [
16
+ ['btn', 'px-6 py-3 rounded-4 border-none inline-block bg-green-400 text-white cursor-pointer outline-hidden hover:bg-green-600 disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50'],
17
+ ],
7
18
  presets: [
8
- presetUno,
9
- presetAttributify,
10
- // 为什么要用到这个插件?
11
- // 模板使用 viewport 作为移动端适配方案,unocss 默认单位为 rem
12
- // 所以需要转成 px,然后由 postcss 把 px 转成 vw/vh,完成适配
13
- presetRemToPx({
14
- // 这里为什么要设置基础字体大小?看下面这篇文章
15
- // https://juejin.cn/post/7262975395620618298
16
- baseFontSize: 4,
17
- }),
18
- presetMini({
19
- dark: {
20
- dark: '.van-theme-dark',
21
- light: '.van-theme-light',
19
+ presetWind4({
20
+ preflights: {
21
+ theme: {
22
+ process: createRemToPxProcessor(BASE_FONT_SIZE),
23
+ },
22
24
  },
23
25
  }),
26
+ presetAttributify(),
27
+ presetIcons(
28
+ {
29
+ scale: 1.2,
30
+ warn: true,
31
+ extraProperties: {
32
+ 'display': 'inline-block',
33
+ 'vertical-align': 'middle',
34
+ 'width': 'var(--van-font-size-md)',
35
+ 'height': 'var(--van-font-size-md)',
36
+ },
37
+ },
38
+ ),
39
+ ],
40
+ postprocess: [
41
+ createRemToPxProcessor(BASE_FONT_SIZE),
42
+ ],
43
+ transformers: [
44
+ transformerDirectives(),
45
+ transformerVariantGroup(),
24
46
  ],
25
- shortcuts: {
26
- // shortcuts to multiple utilities
27
- 'btn': 'py-2 px-4 font-semibold rounded-lg shadow-md',
28
- 'btn-green': 'text-white bg-green-500 hover:bg-green-700',
29
- 'btn-blue': 'text-white bg-blue-500 hover:bg-blue-700',
30
- 'centered': 'absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2',
31
- },
32
47
  })