create-weapp-vite 2.0.46 → 2.0.48

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 (45) hide show
  1. package/dist/{chunk-XOXQYZHI.js → chunk-LIWR2QXJ.js} +10 -9
  2. package/dist/cli.js +1 -1
  3. package/dist/index.js +1 -1
  4. package/package.json +1 -1
  5. package/templates/default/gitignore +1 -0
  6. package/templates/default/package.json +1 -1
  7. package/templates/default/tsconfig.app.json +1 -9
  8. package/templates/lib/gitignore +1 -0
  9. package/templates/lib/package.json +1 -1
  10. package/templates/lib/tsconfig.app.json +1 -9
  11. package/templates/tailwindcss/gitignore +1 -0
  12. package/templates/tailwindcss/package.json +1 -1
  13. package/templates/tailwindcss/tsconfig.app.json +1 -9
  14. package/templates/tdesign/gitignore +1 -0
  15. package/templates/tdesign/package.json +1 -1
  16. package/templates/tdesign/tsconfig.app.json +1 -9
  17. package/templates/vant/gitignore +1 -0
  18. package/templates/vant/package.json +1 -1
  19. package/templates/vant/tsconfig.app.json +1 -9
  20. package/templates/wevu/README.md +1 -0
  21. package/templates/wevu/auto-import-components.json +2 -2
  22. package/templates/wevu/gitignore +1 -0
  23. package/templates/wevu/package.json +1 -1
  24. package/templates/wevu/src/app.vue +49 -7
  25. package/templates/wevu/src/components/InfoPanel/index.vue +52 -0
  26. package/templates/wevu/src/components/StatusPill/index.vue +42 -0
  27. package/templates/wevu/{components.d.ts → src/components.d.ts} +4 -4
  28. package/templates/wevu/src/packageA/pages/workspace/index.vue +137 -0
  29. package/templates/wevu/src/packageB/pages/settings/index.vue +131 -0
  30. package/templates/wevu/src/pages/index/index.vue +169 -304
  31. package/templates/wevu/src/pages/overview/index.vue +149 -0
  32. package/templates/wevu/{typed-components.d.ts → src/typed-components.d.ts} +6 -9
  33. package/templates/wevu/src/typed-router.d.ts +67 -0
  34. package/templates/wevu/tsconfig.app.json +2 -14
  35. package/templates/wevu/vite.config.ts +7 -5
  36. package/templates/wevu-tdesign/gitignore +1 -0
  37. package/templates/wevu-tdesign/package.json +1 -1
  38. package/templates/wevu-tdesign/src/typed-router.d.ts +75 -0
  39. package/templates/wevu-tdesign/src/vite-env.d.ts +0 -2
  40. package/templates/wevu-tdesign/tsconfig.app.json +2 -14
  41. package/templates/wevu-tdesign/vite.config.ts +7 -0
  42. package/templates/wevu/src/components/HelloWorld/index.vue +0 -473
  43. package/templates/wevu/src/components/InfoBanner/index.vue +0 -79
  44. /package/templates/wevu-tdesign/{components.d.ts → src/components.d.ts} +0 -0
  45. /package/templates/wevu-tdesign/{typed-components.d.ts → src/typed-components.d.ts} +0 -0
@@ -0,0 +1,131 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'wevu'
3
+ import { useRoute, useRouter } from 'wevu/router'
4
+
5
+ definePageJson({
6
+ navigationBarTitleText: '系统设置',
7
+ })
8
+
9
+ const HOME_PATH = '/pages/index/index'
10
+ const OVERVIEW_PATH = '/pages/overview/index'
11
+
12
+ const route = useRoute()
13
+ const router = useRouter()
14
+
15
+ const routeSummary = computed(() => route.fullPath || `/${route.path}`)
16
+
17
+ const settingGroups = [
18
+ {
19
+ title: '通知策略',
20
+ description: '预留站内消息、邮件提醒和审批通知等配置位置。',
21
+ },
22
+ {
23
+ title: '角色权限',
24
+ description: '适合接入组织结构、角色分级与操作授权等业务能力。',
25
+ },
26
+ {
27
+ title: '环境信息',
28
+ description: '可以继续扩展版本号、发布通道和系统参数等正式模块。',
29
+ },
30
+ ]
31
+
32
+ async function relaunchHome() {
33
+ await router.nativeRouter.reLaunch({
34
+ url: HOME_PATH,
35
+ })
36
+ }
37
+ </script>
38
+
39
+ <template>
40
+ <view class="page">
41
+ <view class="card">
42
+ <view class="card__eyebrow">
43
+ Settings
44
+ </view>
45
+ <view class="card__title">
46
+ 系统设置
47
+ </view>
48
+ <view class="card__desc">
49
+ 独立分包适合作为设置、配置或低频但相对独立的业务模块承载区。
50
+ </view>
51
+ <view class="card__summary">
52
+ 当前路由:{{ routeSummary }}
53
+ </view>
54
+ </view>
55
+
56
+ <view
57
+ v-for="item in settingGroups"
58
+ :key="item.title"
59
+ class="panel-wrap"
60
+ >
61
+ <InfoPanel
62
+ eyebrow="SETTING"
63
+ :title="item.title"
64
+ :description="item.description"
65
+ />
66
+ </view>
67
+
68
+ <button class="action-btn" @tap="router.push(OVERVIEW_PATH)">
69
+ 查看运营概览
70
+ </button>
71
+ <button class="action-btn action-btn--ghost" @tap="relaunchHome">
72
+ reLaunch 回业务门户
73
+ </button>
74
+ </view>
75
+ </template>
76
+
77
+ <style>
78
+ .page {
79
+ box-sizing: border-box;
80
+ min-height: 100vh;
81
+ padding: 34rpx 30rpx;
82
+ background:
83
+ radial-gradient(circle at top left, rgb(148 163 184 / 14%), transparent 26%),
84
+ linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%);
85
+ }
86
+
87
+ .card {
88
+ padding: 30rpx 28rpx;
89
+ background: #fff;
90
+ border: 2rpx solid #cbd5e1;
91
+ border-radius: 30rpx;
92
+ box-shadow: 0 16rpx 36rpx rgb(15 23 42 / 5%);
93
+ }
94
+
95
+ .card__eyebrow {
96
+ font-size: 22rpx;
97
+ font-weight: 600;
98
+ color: #475569;
99
+ }
100
+
101
+ .card__title {
102
+ margin-top: 10rpx;
103
+ font-size: 40rpx;
104
+ font-weight: 700;
105
+ color: #0f172a;
106
+ }
107
+
108
+ .card__desc,
109
+ .card__summary {
110
+ margin-top: 12rpx;
111
+ font-size: 24rpx;
112
+ line-height: 1.6;
113
+ color: #475569;
114
+ }
115
+
116
+ .panel-wrap {
117
+ margin-top: 18rpx;
118
+ }
119
+
120
+ .action-btn {
121
+ margin-top: 18rpx;
122
+ color: #fff;
123
+ background: #0f172a;
124
+ border-radius: 999rpx;
125
+ }
126
+
127
+ .action-btn--ghost {
128
+ color: #0f172a;
129
+ background: #e2e8f0;
130
+ }
131
+ </style>
@@ -1,268 +1,130 @@
1
1
  <script setup lang="ts">
2
- import { computed, ref, watch } from 'wevu'
3
-
4
- interface HelloActionPayload {
5
- type: 'toggle' | 'copy' | 'select' | 'stats'
6
- value?: string
7
- }
8
-
9
- type HighlightTone = 'up' | 'down' | 'flat'
10
-
11
- interface HighlightItem {
12
- key: string
13
- label: string
14
- value: string | number
15
- tone?: HighlightTone
16
- note?: string
17
- }
2
+ import { computed } from 'wevu'
3
+ import { useRoute, useRouter } from 'wevu/router'
18
4
 
19
5
  definePageJson({
20
- navigationBarTitleText: '首页示例',
6
+ navigationBarTitleText: '业务门户',
21
7
  })
22
8
 
23
- const count = ref(0)
24
- const message = ref('Hello WeVU!')
25
- const activeGroup = ref('概览')
9
+ const HOME_PATH = '/pages/index/index'
10
+ const OVERVIEW_PATH = '/pages/overview/index'
11
+ const WORKSPACE_PATH = '/packageA/pages/workspace/index'
12
+ const SETTINGS_PATH = '/packageB/pages/settings/index'
26
13
 
27
- const todos = ref([
28
- {
29
- id: 'sfc',
30
- title: '自动编译 SFC 到小程序四件套',
31
- group: 'template' as const,
32
- done: true,
33
- level: 'advanced' as const,
34
- },
35
- {
36
- id: 'components',
37
- title: '自动注入 usingComponents 与组件类型提示',
38
- group: 'template' as const,
39
- done: true,
40
- level: 'base' as const,
41
- },
14
+ const route = useRoute()
15
+ const router = useRouter()
16
+ const routeSummary = computed(() => route.fullPath || `/${route.path}`)
17
+
18
+ const metrics = [
19
+ { label: '本周跟进事项', value: '12', detail: '含 3 项需今日确认' },
20
+ { label: '交付进度', value: '86%', detail: '版本提测准备完成' },
21
+ { label: '服务可用率', value: '99.95%', detail: '核心链路运行稳定' },
22
+ ]
23
+
24
+ const quickLinks = [
42
25
  {
43
- id: 'pipeline',
44
- title: 'WXML/WXSS/WXS 全链路处理与平台适配',
45
- group: 'engineering' as const,
46
- done: true,
47
- level: 'advanced' as const,
26
+ title: '运营概览',
27
+ description: '查看阶段目标、团队协同与项目节奏。',
28
+ action: '进入概览',
29
+ path: OVERVIEW_PATH,
48
30
  },
49
31
  {
50
- id: 'events',
51
- title: '支持 @tap.catch / @tap.stop 等事件语义',
52
- group: 'core' as const,
53
- done: true,
54
- level: 'base' as const,
32
+ title: '项目工作台',
33
+ description: '集中处理待办任务、优先级与排期。',
34
+ action: '打开工作台',
35
+ path: WORKSPACE_PATH,
55
36
  },
56
37
  {
57
- id: 'reactivity',
58
- title: '通过 wevu 使用 ref/computed/watch 写业务逻辑',
59
- group: 'core' as const,
60
- done: true,
61
- level: 'advanced' as const,
38
+ title: '系统设置',
39
+ description: '统一管理通知、权限与环境配置。',
40
+ action: '前往设置',
41
+ path: SETTINGS_PATH,
62
42
  },
63
- ])
64
-
65
- const doubled = computed(() => count.value * 2)
66
-
67
- const pageClass = computed(() => {
68
- return {
69
- 'page-empty': count.value === 0,
70
- 'page-energetic': count.value > 0,
71
- }
72
- })
73
-
74
- const pageStyle = computed(() => {
75
- return [
76
- {
77
- background: count.value > 0 ? '#eaf0ff' : '#f6f7ff',
78
- },
79
- {
80
- borderTop: count.value > 0 ? '4rpx solid #4c6ef5' : '4rpx solid transparent',
81
- },
82
- ]
83
- })
84
-
85
- const cardClass = computed(() => {
86
- return [
87
- {
88
- 'card-active': count.value > 0,
89
- },
90
- count.value >= 3 ? 'card-boost' : '',
91
- ]
92
- })
93
-
94
- const cardStyle = computed(() => {
95
- return [
96
- {
97
- borderColor: count.value > 0 ? '#4c6ef5' : 'transparent',
98
- },
99
- {
100
- borderWidth: count.value > 0 ? '2rpx' : '1rpx',
101
- },
102
- ]
103
- })
43
+ ]
104
44
 
105
- const primaryBtnClass = computed(() => {
106
- return [
107
- {
108
- 'btn-boost': count.value > 0,
109
- },
110
- count.value >= 3 ? 'btn-boost-strong' : '',
111
- ]
112
- })
113
-
114
- const primaryBtnStyle = computed(() => {
115
- return [
116
- {
117
- opacity: count.value > 0 ? 0.88 : 1,
118
- },
119
- count.value > 0
120
- ? {
121
- boxShadow: '0 8rpx 20rpx rgba(76, 110, 245, 0.28)',
122
- }
123
- : null,
124
- ]
125
- })
126
-
127
- const helloHighlights = computed<HighlightItem[]>(() => {
128
- return [
129
- {
130
- key: 'count',
131
- label: '当前计数',
132
- value: count.value,
133
- tone: 'up' as const,
134
- note: '来自 ref 状态',
135
- },
136
- {
137
- key: 'double',
138
- label: '双倍值',
139
- value: doubled.value,
140
- tone: 'flat' as const,
141
- note: '来自 computed',
142
- },
143
- {
144
- key: 'feature',
145
- label: '能力条目',
146
- value: todos.value.length,
147
- tone: 'flat' as const,
148
- note: '模板清单',
149
- },
150
- {
151
- key: 'title',
152
- label: '标题长度',
153
- value: message.value.length,
154
- tone: message.value.length > 10 ? 'up' : 'down',
155
- note: '来自 v-model',
156
- },
157
- ]
158
- })
159
-
160
- function showToast(title: string) {
161
- wx.showToast({
162
- title,
163
- icon: 'none',
164
- duration: 1200,
165
- })
45
+ async function pushTo(path: string) {
46
+ await router.push(path)
166
47
  }
167
48
 
168
- function increment() {
169
- count.value += 1
170
- }
171
-
172
- function reset() {
173
- count.value = 0
174
- showToast('计数已重置')
175
- }
176
-
177
- function handleHelloAction(payload: HelloActionPayload) {
178
- if (payload.type === 'copy' && payload.value) {
179
- wx.setClipboardData({
180
- data: payload.value,
181
- })
182
- return
183
- }
184
-
185
- if (payload.type === 'toggle') {
186
- showToast(`面板状态:${payload.value === 'true' ? '展开' : '收起'}`)
187
- return
188
- }
189
-
190
- if (payload.type === 'select' && payload.value) {
191
- activeGroup.value = payload.value
192
- showToast(`当前焦点:${payload.value}`)
193
- return
194
- }
195
-
196
- if (payload.type === 'stats' && payload.value) {
197
- console.log(`[wevu] hello progress: ${payload.value}%`)
198
- }
49
+ async function relaunchToHome() {
50
+ await router.nativeRouter.reLaunch({
51
+ url: HOME_PATH,
52
+ })
199
53
  }
200
-
201
- watch(count, (newValue, oldValue) => {
202
- console.log(`[wevu] count changed: ${oldValue} -> ${newValue}`)
203
- })
204
54
  </script>
205
55
 
206
56
  <template>
207
- <view class="page" :class="pageClass" :style="pageStyle">
208
- <InfoBanner
209
- :title="message"
210
- :description="`group=${activeGroup}, count=${count}, doubled=${doubled}`"
211
- badge="Demo"
212
- />
57
+ <view class="page">
58
+ <view class="hero">
59
+ <view class="hero__eyebrow">
60
+ 企业业务模板
61
+ </view>
62
+ <view class="hero__title">
63
+ 适合作为正式项目起点的首页框架
64
+ </view>
65
+ <view class="hero__desc">
66
+ 内置主包与分包页面结构、统一导航入口与简洁信息模块,默认呈现正式、克制且便于继续扩展的业务模板风格。
67
+ </view>
68
+ <view class="hero__pills">
69
+ <StatusPill label="主包首页" tone="accent" />
70
+ <StatusPill label="可扩展分包" tone="neutral" />
71
+ <StatusPill label="适合二次开发" tone="success" />
72
+ </view>
73
+ </view>
213
74
 
214
- <HelloWorld
215
- :title="`欢迎,${message}`"
216
- :subtitle="`HelloWorld 示例面板(当前分组:${activeGroup})`"
217
- :highlights="helloHighlights"
218
- :features="todos"
219
- @action="handleHelloAction"
220
- >
221
- <template #footer>
222
- <view class="hello-footer">
223
- <text class="hello-footer-text">
224
- 此区域来自父组件 slot,展示 wevu + weapp-vite 组合能力。
225
- </text>
75
+ <view class="section">
76
+ <view class="section__title">
77
+ 核心指标
78
+ </view>
79
+ <view
80
+ v-for="item in metrics"
81
+ :key="item.label"
82
+ class="metric-card"
83
+ >
84
+ <view class="metric-card__label">
85
+ {{ item.label }}
86
+ </view>
87
+ <view class="metric-card__value">
88
+ {{ item.value }}
89
+ </view>
90
+ <view class="metric-card__detail">
91
+ {{ item.detail }}
226
92
  </view>
227
- </template>
228
- </HelloWorld>
229
-
230
- <view class="card" :class="cardClass" :style="cardStyle">
231
- <view class="row">
232
- <text class="label">
233
- 当前计数:{{ count }}
234
- </text>
235
- <text class="label">
236
- 双倍:{{ doubled }}
237
- </text>
238
93
  </view>
94
+ </view>
239
95
 
240
- <view class="row actions">
241
- <button class="btn primary" :class="primaryBtnClass" :style="primaryBtnStyle" @tap.catch="increment">
242
- +1
243
- </button>
244
- <button class="btn danger" @tap.stop="reset">
245
- 重置
246
- </button>
96
+ <view class="section">
97
+ <view class="section__title">
98
+ 常用入口
247
99
  </view>
248
-
249
- <view class="row">
250
- <text class="label">
251
- 文本双向绑定:
252
- </text>
100
+ <view
101
+ v-for="link in quickLinks"
102
+ :key="link.path"
103
+ class="entry-card"
104
+ >
105
+ <InfoPanel
106
+ eyebrow="PAGE"
107
+ :title="link.title"
108
+ :description="link.description"
109
+ />
110
+ <button class="action-btn" @tap="pushTo(link.path)">
111
+ {{ link.action }}
112
+ </button>
253
113
  </view>
254
- <input v-model="message" class="input" placeholder="输入标题…">
114
+ </view>
255
115
 
256
- <view class="row">
257
- <text class="label">
258
- Checklist
259
- </text>
260
- </view>
261
- <view class="todo">
262
- <view v-for="(todo, index) in todos" :key="index" class="todo-item">
263
- <text>• {{ todo.title }}</text>
264
- </view>
116
+ <view class="section">
117
+ <InfoPanel
118
+ eyebrow="ROUTER"
119
+ title="导航状态"
120
+ description="模板保留路由能力作为底层基础,但将其放在辅助信息层,避免首页呈现为技术功能演示页。"
121
+ />
122
+ <view class="route-note">
123
+ 当前路由:{{ routeSummary }}
265
124
  </view>
125
+ <button class="action-btn action-btn--light" @tap="relaunchToHome">
126
+ reLaunch 当前首页
127
+ </button>
266
128
  </view>
267
129
  </view>
268
130
  </template>
@@ -271,100 +133,103 @@ watch(count, (newValue, oldValue) => {
271
133
  .page {
272
134
  box-sizing: border-box;
273
135
  min-height: 100vh;
274
- padding: 0 32rpx 64rpx;
275
- background: #f6f7ff;
136
+ padding: 28rpx 28rpx 40rpx;
137
+ background:
138
+ radial-gradient(circle at top right, rgb(59 130 246 / 12%), transparent 30%),
139
+ linear-gradient(180deg, #f8fafc 0%, #eef3f8 100%);
276
140
  }
277
141
 
278
- .page-empty {
279
- opacity: 0.98;
142
+ .hero {
143
+ padding: 36rpx 30rpx;
144
+ background: linear-gradient(160deg, #0f172a, #1e293b 72%, #334155);
145
+ border-radius: 32rpx;
146
+ box-shadow: 0 24rpx 60rpx rgb(15 23 42 / 18%);
280
147
  }
281
148
 
282
- .page-energetic {
283
- background: #f1f4ff;
284
- }
285
-
286
- .card {
287
- padding: 32rpx;
288
- margin-top: 24rpx;
289
- background: #fff;
290
- border: 2rpx solid transparent;
291
- border-radius: 24rpx;
292
- box-shadow: 0 12rpx 32rpx rgb(44 44 84 / 10%);
149
+ .hero__eyebrow {
150
+ font-size: 22rpx;
151
+ font-weight: 600;
152
+ color: rgb(226 232 240 / 88%);
153
+ letter-spacing: 2rpx;
293
154
  }
294
155
 
295
- .card-active {
296
- box-shadow: 0 14rpx 36rpx rgb(76 110 245 / 14%);
156
+ .hero__title {
157
+ margin-top: 16rpx;
158
+ font-size: 42rpx;
159
+ font-weight: 700;
160
+ line-height: 1.35;
161
+ color: #fff;
297
162
  }
298
163
 
299
- .card-boost {
300
- transform: translateY(-2rpx);
164
+ .hero__desc {
165
+ margin-top: 16rpx;
166
+ font-size: 24rpx;
167
+ line-height: 1.6;
168
+ color: rgb(226 232 240 / 88%);
301
169
  }
302
170
 
303
- .row {
171
+ .hero__pills {
304
172
  display: flex;
305
- gap: 16rpx;
306
- align-items: center;
307
- justify-content: space-between;
308
- margin-bottom: 16rpx;
309
- }
310
-
311
- .label {
312
- font-size: 30rpx;
313
- color: #1c1c3c;
314
- }
315
-
316
- .actions {
317
- margin: 24rpx 0;
173
+ flex-wrap: wrap;
174
+ gap: 14rpx;
175
+ margin-top: 24rpx;
318
176
  }
319
177
 
320
- .btn {
321
- flex: 1;
322
- line-height: 96rpx;
323
- color: #fff;
324
- border-radius: 16rpx;
178
+ .section {
179
+ margin-top: 24rpx;
325
180
  }
326
181
 
327
- .btn.primary {
328
- background: #4c6ef5;
182
+ .section__title {
183
+ margin-bottom: 16rpx;
184
+ font-size: 28rpx;
185
+ font-weight: 700;
186
+ color: #0f172a;
329
187
  }
330
188
 
331
- .btn-boost {
332
- transform: scale(1.02);
189
+ .metric-card,
190
+ .entry-card {
191
+ padding: 24rpx;
192
+ margin-top: 16rpx;
193
+ background: rgb(255 255 255 / 92%);
194
+ border: 2rpx solid rgb(226 232 240 / 88%);
195
+ border-radius: 28rpx;
196
+ box-shadow: 0 12rpx 32rpx rgb(15 23 42 / 4%);
333
197
  }
334
198
 
335
- .btn-boost-strong {
336
- transform: scale(1.04);
199
+ .metric-card__label {
200
+ font-size: 22rpx;
201
+ color: #64748b;
337
202
  }
338
203
 
339
- .btn.danger {
340
- background: #f03e3e;
204
+ .metric-card__value {
205
+ margin-top: 12rpx;
206
+ font-size: 44rpx;
207
+ font-weight: 700;
208
+ color: #0f172a;
341
209
  }
342
210
 
343
- .input {
344
- box-sizing: border-box;
345
- height: 88rpx;
346
- padding: 0 24rpx;
347
- margin: 0 0 24rpx;
348
- background: #fff;
349
- border: 2rpx solid #e9ecef;
350
- border-radius: 16rpx;
211
+ .metric-card__detail {
212
+ margin-top: 8rpx;
213
+ font-size: 24rpx;
214
+ line-height: 1.6;
215
+ color: #475569;
351
216
  }
352
217
 
353
- .todo-item {
354
- margin-bottom: 12rpx;
355
- font-size: 26rpx;
356
- color: #4f4f7a;
218
+ .route-note {
219
+ margin-top: 16rpx;
220
+ font-size: 22rpx;
221
+ color: #64748b;
357
222
  }
358
223
 
359
- .hello-footer {
360
- padding: 12rpx 14rpx;
361
- margin-top: 16rpx;
362
- background: #eef2ff;
363
- border-radius: 12rpx;
224
+ .action-btn {
225
+ margin-top: 18rpx;
226
+ color: #fff;
227
+ background: #0f172a;
228
+ border-radius: 999rpx;
364
229
  }
365
230
 
366
- .hello-footer-text {
367
- font-size: 22rpx;
368
- color: #4f5ea0;
231
+ .action-btn--light {
232
+ color: #0f172a;
233
+ background: #e2e8f0;
369
234
  }
370
235
  </style>