create-weapp-vite 2.3.15 → 2.3.17

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 (74) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/{src-D8uqfCKh.js → src-DUTngca4.js} +4 -4
  4. package/package.json +1 -1
  5. package/templates/default/.vscode/settings.json +2 -1
  6. package/templates/lib/.vscode/settings.json +2 -1
  7. package/templates/lib/package.json +1 -1
  8. package/templates/tailwindcss/.vscode/settings.json +2 -1
  9. package/templates/tdesign/.vscode/settings.json +2 -1
  10. package/templates/vant/.vscode/settings.json +2 -1
  11. package/templates/wevu/.vscode/settings.json +2 -1
  12. package/templates/wevu/README.md +3 -3
  13. package/templates/wevu/package.json +1 -1
  14. package/templates/wevu/src/app.vue +1 -60
  15. package/templates/wevu/src/pages/index/index.vue +26 -194
  16. package/templates/wevu/src/pages/layouts/index.vue +0 -18
  17. package/templates/wevu/weapp-vite.config.ts +0 -7
  18. package/templates/wevu-tdesign/.vscode/settings.json +2 -1
  19. package/templates/wevu-tdesign/README.md +3 -6
  20. package/templates/wevu-tdesign/package.json +1 -1
  21. package/templates/wevu-tdesign/project.private.config.json +0 -66
  22. package/templates/wevu-tdesign/src/app.vue +1 -73
  23. package/templates/wevu-tdesign/src/pages/index/index.vue +19 -362
  24. package/templates/wevu/src/components/InfoPanel/index.vue +0 -52
  25. package/templates/wevu/src/components/StatusPill/index.vue +0 -42
  26. package/templates/wevu/src/packageA/pages/workspace/index.vue +0 -137
  27. package/templates/wevu/src/packageB/pages/settings/index.vue +0 -131
  28. package/templates/wevu/src/pages/overview/index.vue +0 -149
  29. package/templates/wevu-tdesign/public/tabbar/ability-active.png +0 -0
  30. package/templates/wevu-tdesign/public/tabbar/ability.png +0 -0
  31. package/templates/wevu-tdesign/public/tabbar/data-active.png +0 -0
  32. package/templates/wevu-tdesign/public/tabbar/data.png +0 -0
  33. package/templates/wevu-tdesign/public/tabbar/form-active.png +0 -0
  34. package/templates/wevu-tdesign/public/tabbar/form.png +0 -0
  35. package/templates/wevu-tdesign/public/tabbar/home-active.png +0 -0
  36. package/templates/wevu-tdesign/public/tabbar/home.png +0 -0
  37. package/templates/wevu-tdesign/public/tabbar/list-active.png +0 -0
  38. package/templates/wevu-tdesign/public/tabbar/list.png +0 -0
  39. package/templates/wevu-tdesign/src/components/EmptyState/index.vue +0 -36
  40. package/templates/wevu-tdesign/src/components/FilterBar/index.vue +0 -64
  41. package/templates/wevu-tdesign/src/components/FormRow/index.vue +0 -43
  42. package/templates/wevu-tdesign/src/components/FormStep/index.vue +0 -48
  43. package/templates/wevu-tdesign/src/components/KpiBoard/index.vue +0 -145
  44. package/templates/wevu-tdesign/src/components/QuickActionGrid/index.vue +0 -79
  45. package/templates/wevu-tdesign/src/components/ResultCard/index.vue +0 -51
  46. package/templates/wevu-tdesign/src/components/SectionTitle/index.vue +0 -34
  47. package/templates/wevu-tdesign/src/components/TrendCard/index.vue +0 -101
  48. package/templates/wevu-tdesign/src/components/VirtualHostClassDemo/BrokenCard.vue +0 -46
  49. package/templates/wevu-tdesign/src/components/VirtualHostClassDemo/FixedExternalClassCard.vue +0 -50
  50. package/templates/wevu-tdesign/src/components/VirtualHostClassDemo/RecommendedCard.vue +0 -53
  51. package/templates/wevu-tdesign/src/hooks/useDialog.ts +0 -205
  52. package/templates/wevu-tdesign/src/hooks/useFormBinder.ts +0 -17
  53. package/templates/wevu-tdesign/src/hooks/useLayoutFeedbackBridge.ts +0 -17
  54. package/templates/wevu-tdesign/src/hooks/usePullDownRefresh.ts +0 -12
  55. package/templates/wevu-tdesign/src/hooks/useToast.ts +0 -100
  56. package/templates/wevu-tdesign/src/layouts/admin.vue +0 -41
  57. package/templates/wevu-tdesign/src/layouts/default.vue +0 -23
  58. package/templates/wevu-tdesign/src/pages/ability/index.vue +0 -164
  59. package/templates/wevu-tdesign/src/pages/data/index.vue +0 -189
  60. package/templates/wevu-tdesign/src/pages/form/index.vue +0 -271
  61. package/templates/wevu-tdesign/src/pages/layout-feedback/components/FeedbackCallerCard.vue +0 -79
  62. package/templates/wevu-tdesign/src/pages/layout-feedback/index.vue +0 -211
  63. package/templates/wevu-tdesign/src/pages/layout-store/index.vue +0 -127
  64. package/templates/wevu-tdesign/src/pages/layouts/index.vue +0 -120
  65. package/templates/wevu-tdesign/src/pages/list/index.vue +0 -146
  66. package/templates/wevu-tdesign/src/stores/layoutInteractionDemo.ts +0 -129
  67. package/templates/wevu-tdesign/src/subpackages/ability/index.vue +0 -103
  68. package/templates/wevu-tdesign/src/subpackages/lab/class-binding/index.vue +0 -440
  69. package/templates/wevu-tdesign/src/subpackages/lab/index.vue +0 -169
  70. package/templates/wevu-tdesign/src/subpackages/lab/virtual-host-class/index.vue +0 -94
  71. package/templates/wevu-tdesign/src/types/action.ts +0 -14
  72. package/templates/wevu-tdesign/src/types/list.ts +0 -17
  73. package/templates/wevu-tdesign/src/utils/changeEvent.ts +0 -53
  74. package/templates/wevu-tdesign/src/utils/listFilters.ts +0 -34
@@ -1,129 +0,0 @@
1
- import { computed, defineStore, ref } from 'wevu'
2
- import { alertDialog, confirmDialog } from '@/hooks/useDialog'
3
- import { showToast } from '@/hooks/useToast'
4
-
5
- export type LayoutKind = 'default' | 'admin'
6
- export type LayoutCommandType = 'toast' | 'alert' | 'confirm'
7
- export type LayoutCommandStatus = 'idle' | 'running'
8
-
9
- export interface LayoutCommand {
10
- id: number
11
- title: string
12
- content: string
13
- type: LayoutCommandType
14
- }
15
-
16
- function createLog(message: string) {
17
- return `${new Date().toLocaleTimeString()} ${message}`
18
- }
19
-
20
- export const useLayoutInteractionDemoStore = defineStore('layout-interaction-demo', () => {
21
- const activeLayout = ref<LayoutKind>('default')
22
- const commandSeed = ref(0)
23
- const commandStatus = ref<LayoutCommandStatus>('idle')
24
- const lastResult = ref('尚未触发交互')
25
- const logs = ref<string[]>([
26
- createLog('Store 已就绪,当前由 store 直接调用 layout 宿主。'),
27
- ])
28
-
29
- const adminLayoutProps = computed(() => ({
30
- title: 'Store Admin Layout',
31
- subtitle: `当前通过 wevu/store 驱动,最近动作:${lastResult.value}`,
32
- }))
33
-
34
- function appendLog(message: string) {
35
- logs.value = [createLog(message), ...logs.value].slice(0, 8)
36
- }
37
-
38
- function setLayout(layout: LayoutKind) {
39
- activeLayout.value = layout
40
- appendLog(`切换到 ${layout} 布局`)
41
- }
42
-
43
- function createCommand(type: LayoutCommandType, title: string, content: string): LayoutCommand {
44
- commandSeed.value += 1
45
- return {
46
- id: commandSeed.value,
47
- type,
48
- title,
49
- content,
50
- }
51
- }
52
-
53
- async function runCommand(command: LayoutCommand) {
54
- commandStatus.value = 'running'
55
- appendLog(`Store 请求 ${command.title}`)
56
-
57
- if (command.type === 'toast') {
58
- showToast(command.content)
59
- finishCommand(`${command.title} 已由 ${activeLayout.value} layout 宿主展示`)
60
- return
61
- }
62
-
63
- if (command.type === 'alert') {
64
- await alertDialog({
65
- title: command.title,
66
- content: command.content,
67
- confirmBtn: '知道了',
68
- })
69
- finishCommand(`${command.title} 已确认`)
70
- return
71
- }
72
-
73
- try {
74
- await confirmDialog({
75
- title: command.title,
76
- content: command.content,
77
- confirmBtn: '确认',
78
- cancelBtn: '取消',
79
- })
80
- finishCommand(`${command.title} 点击确认`)
81
- }
82
- catch {
83
- finishCommand(`${command.title} 点击取消`)
84
- }
85
- }
86
-
87
- function triggerToast() {
88
- return runCommand(
89
- createCommand('toast', `Store Toast #${commandSeed.value + 1}`, `当前由 ${activeLayout.value} layout 宿主展示 toast。`),
90
- )
91
- }
92
-
93
- function triggerAlert() {
94
- return runCommand(
95
- createCommand('alert', `Store Alert #${commandSeed.value + 1}`, `当前由 ${activeLayout.value} layout 宿主展示 alert。`),
96
- )
97
- }
98
-
99
- function triggerConfirm() {
100
- return runCommand(
101
- createCommand('confirm', `Store Confirm #${commandSeed.value + 1}`, `请确认由 ${activeLayout.value} layout 宿主承载的确认弹窗。`),
102
- )
103
- }
104
-
105
- function finishCommand(message: string) {
106
- lastResult.value = message
107
- commandStatus.value = 'idle'
108
- appendLog(message)
109
- }
110
-
111
- function resetLogs() {
112
- logs.value = [createLog('已清空日志,继续观察 store 与 layout 的通信。')]
113
- lastResult.value = '日志已清空'
114
- }
115
-
116
- return {
117
- activeLayout,
118
- adminLayoutProps,
119
- commandStatus,
120
- lastResult,
121
- logs,
122
- finishCommand,
123
- resetLogs,
124
- setLayout,
125
- triggerAlert,
126
- triggerConfirm,
127
- triggerToast,
128
- }
129
- })
@@ -1,103 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, onShow, ref } from 'wevu'
3
- import { wpi } from 'wevu/api'
4
-
5
- import SectionTitle from '@/components/SectionTitle/index.vue'
6
-
7
- definePageJson({
8
- navigationBarTitleText: 'API 场景',
9
- backgroundColor: '#f6f7fb',
10
- })
11
-
12
- const systemInfo = ref<WechatMiniprogram.SystemInfo | null>(null)
13
-
14
- const infoRows = computed(() => {
15
- const info = systemInfo.value
16
- return [
17
- { label: '机型', value: info?.model ?? '--' },
18
- { label: '系统', value: info ? `${info.system}` : '--' },
19
- { label: '版本', value: info?.version ?? '--' },
20
- { label: '基础库', value: info?.SDKVersion ?? '--' },
21
- ]
22
- })
23
-
24
- const layoutRows = computed(() => {
25
- const info = systemInfo.value
26
- if (!info) {
27
- return []
28
- }
29
- return [
30
- { label: '屏幕宽度', value: `${info.windowWidth}px` },
31
- { label: '屏幕高度', value: `${info.windowHeight}px` },
32
- { label: '状态栏', value: `${info.statusBarHeight}px` },
33
- ]
34
- })
35
-
36
- async function loadSystemInfo() {
37
- systemInfo.value = await wpi.getSystemInfo()
38
- }
39
-
40
- onShow(() => {
41
- void loadSystemInfo()
42
- })
43
- </script>
44
-
45
- <template>
46
- <view class="min-h-screen bg-[#f6f7fb] px-[28rpx] pb-[88rpx] pt-[24rpx] text-[#1c1c3c]">
47
- <view class="rounded-[28rpx] bg-linear-to-br from-[#ecfccb] via-[#ffffff] to-[#d9f99d] p-[20rpx]">
48
- <SectionTitle title="系统信息" subtitle="使用原生 API 获取设备信息" />
49
- </view>
50
-
51
- <view class="mt-[18rpx] rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
52
- <SectionTitle title="设备概览" subtitle="基础信息卡片" />
53
- <view class="mt-[12rpx] space-y-[10rpx]">
54
- <view v-for="row in infoRows" :key="row.label" class="flex items-center justify-between">
55
- <text class="text-[22rpx] text-[#6f6b8a]">
56
- {{ row.label }}
57
- </text>
58
- <text class="text-[22rpx] font-semibold text-[#1f1a3f]">
59
- {{ row.value }}
60
- </text>
61
- </view>
62
- </view>
63
- </view>
64
-
65
- <view class="mt-[18rpx] rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
66
- <SectionTitle title="布局信息" subtitle="适配屏幕尺寸" />
67
- <view class="mt-[12rpx] space-y-[10rpx]">
68
- <view v-for="row in layoutRows" :key="row.label" class="flex items-center justify-between">
69
- <text class="text-[22rpx] text-[#6f6b8a]">
70
- {{ row.label }}
71
- </text>
72
- <text class="text-[22rpx] font-semibold text-[#1f1a3f]">
73
- {{ row.value }}
74
- </text>
75
- </view>
76
- </view>
77
- </view>
78
-
79
- <view class="mt-[18rpx] rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
80
- <SectionTitle title="构建提示" subtitle="weapp-vite 特性" />
81
- <view class="mt-[12rpx] space-y-[10rpx]">
82
- <view class="flex items-center gap-[8rpx]">
83
- <view class="h-[8rpx] w-[8rpx] rounded-full bg-[#2f2b5f]" />
84
- <text class="text-[22rpx] text-[#4c4b68]">
85
- 子包页面按需加载,降低首包压力
86
- </text>
87
- </view>
88
- <view class="flex items-center gap-[8rpx]">
89
- <view class="h-[8rpx] w-[8rpx] rounded-full bg-[#2f2b5f]" />
90
- <text class="text-[22rpx] text-[#4c4b68]">
91
- 组件与页面使用 alias 路径统一管理
92
- </text>
93
- </view>
94
- <view class="flex items-center gap-[8rpx]">
95
- <view class="h-[8rpx] w-[8rpx] rounded-full bg-[#2f2b5f]" />
96
- <text class="text-[22rpx] text-[#4c4b68]">
97
- 全局样式隔离使用 apply-shared
98
- </text>
99
- </view>
100
- </view>
101
- </view>
102
- </view>
103
- </template>
@@ -1,440 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, reactive, ref, watch } from 'wevu'
3
-
4
- import SectionTitle from '@/components/SectionTitle/index.vue'
5
- import { resolveBooleanChangeValue } from '@/utils/changeEvent'
6
-
7
- definePageJson({
8
- navigationBarTitleText: 'Class 绑定',
9
- backgroundColor: '#f6f7fb',
10
- })
11
-
12
- const isActive = ref(true)
13
- const hasError = ref(false)
14
- const isRound = ref(false)
15
- const isGhost = ref(false)
16
-
17
- function onActiveChange(event: unknown) {
18
- isActive.value = resolveBooleanChangeValue(event, !isActive.value)
19
- }
20
-
21
- function onErrorChange(event: unknown) {
22
- hasError.value = resolveBooleanChangeValue(event, !hasError.value)
23
- }
24
-
25
- function onRoundChange(event: unknown) {
26
- isRound.value = resolveBooleanChangeValue(event, !isRound.value)
27
- }
28
-
29
- function onGhostChange(event: unknown) {
30
- isGhost.value = resolveBooleanChangeValue(event, !isGhost.value)
31
- }
32
-
33
- const classObject = reactive({
34
- 'demo-active': true,
35
- 'text-danger': false,
36
- 'demo-round': false,
37
- 'demo-ghost': false,
38
- })
39
-
40
- watch([isActive, hasError, isRound, isGhost], ([active, error, round, ghost]) => {
41
- classObject['demo-active'] = active
42
- classObject['text-danger'] = error
43
- classObject['demo-round'] = round
44
- classObject['demo-ghost'] = ghost
45
- }, { immediate: true })
46
-
47
- const activeClass = ref('demo-active')
48
- const errorClass = ref('text-danger')
49
- const roundClass = ref('demo-round')
50
- const ghostClass = ref('demo-ghost')
51
-
52
- const activeClassIf = computed(() => (isActive.value ? activeClass.value : ''))
53
- const errorClassIf = computed(() => (hasError.value ? errorClass.value : ''))
54
- const roundClassIf = computed(() => (isRound.value ? roundClass.value : ''))
55
- const ghostClassIf = computed(() => (isGhost.value ? ghostClass.value : ''))
56
- const dynamicKeyClass = computed(() => ({ [activeClass.value]: isActive.value }))
57
-
58
- const styleObject = computed(() => ({
59
- background: hasError.value
60
- ? '#fff1f2'
61
- : isActive.value
62
- ? 'linear-gradient(135deg,#2563eb,#6366f1)'
63
- : '#ffffff',
64
- borderColor: hasError.value ? '#ef4444' : isActive.value ? '#1e40af' : '#d7d9f2',
65
- borderStyle: isGhost.value ? 'dashed' : 'solid',
66
- borderRadius: isRound.value ? '999rpx' : '18rpx',
67
- color: hasError.value ? '#b91c1c' : isActive.value ? '#ffffff' : '#1f1a3f',
68
- }))
69
-
70
- const styleArray = computed(() => ([
71
- { transition: 'all 0.2s ease' },
72
- isActive.value ? { transform: 'translateY(-4rpx)' } : { transform: 'translateY(0rpx)' },
73
- hasError.value
74
- ? { boxShadow: '0 18rpx 32rpx rgba(239,68,68,0.2)' }
75
- : { boxShadow: '0 10rpx 20rpx rgba(37,99,235,0.28)' },
76
- isRound.value ? { borderRadius: '999rpx' } : { borderRadius: '18rpx' },
77
- isGhost.value ? { opacity: '0.78' } : { opacity: '1' },
78
- ]))
79
-
80
- const styleString = computed(() => {
81
- const fontSize = isActive.value ? 26 : 24
82
- const color = hasError.value ? '#b91c1c' : '#1f1a3f'
83
- const spacing = isGhost.value ? 1.2 : 0.5
84
- return `font-size:${fontSize}rpx;color:${color};letter-spacing:${spacing}rpx;`
85
- })
86
-
87
- const styleWithVar = computed(() => {
88
- const accent = hasError.value ? '#ef4444' : '#2563eb'
89
- return {
90
- '--lab-accent': accent,
91
- 'borderColor': 'var(--lab-accent)',
92
- 'color': 'var(--lab-accent)',
93
- }
94
- })
95
-
96
- function applyScenarioBase() {
97
- isActive.value = false
98
- hasError.value = false
99
- isRound.value = false
100
- isGhost.value = false
101
- }
102
-
103
- function applyScenarioAllOn() {
104
- isActive.value = true
105
- hasError.value = true
106
- isRound.value = true
107
- isGhost.value = true
108
- }
109
-
110
- function applyScenarioMixed() {
111
- isActive.value = true
112
- hasError.value = false
113
- isRound.value = true
114
- isGhost.value = false
115
- }
116
-
117
- function applyScenarioErrorGhost() {
118
- isActive.value = false
119
- hasError.value = true
120
- isRound.value = false
121
- isGhost.value = true
122
- }
123
-
124
- function runE2EState() {
125
- return {
126
- isActive: isActive.value,
127
- hasError: hasError.value,
128
- isRound: isRound.value,
129
- isGhost: isGhost.value,
130
- classObject: { ...classObject },
131
- activeClassIf: activeClassIf.value,
132
- errorClassIf: errorClassIf.value,
133
- roundClassIf: roundClassIf.value,
134
- ghostClassIf: ghostClassIf.value,
135
- styleString: styleString.value,
136
- }
137
- }
138
- </script>
139
-
140
- <template>
141
- <view class="min-h-screen bg-[#f6f7fb] px-[28rpx] pb-[88rpx] pt-[24rpx] text-[#1c1c3c]">
142
- <view class="rounded-[28rpx] bg-linear-to-br from-[#eef2ff] via-[#ffffff] to-[#e0f2fe] p-[20rpx]">
143
- <SectionTitle title="Class 绑定实验室" subtitle="切换状态观察 Vue 3 class 绑定效果" />
144
- </view>
145
-
146
- <view class="mt-[18rpx] rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
147
- <SectionTitle title="状态控制" subtitle="开关影响所有示例" />
148
- <view class="mt-[12rpx] grid grid-cols-2 gap-[12rpx]">
149
- <view class="rounded-[16rpx] bg-[#f8fafc] p-[12rpx]">
150
- <view class="flex items-center justify-between">
151
- <text class="text-[22rpx] text-[#5c5b7a]">
152
- Active
153
- </text>
154
- <t-switch :value="isActive" @change="onActiveChange" />
155
- </view>
156
- </view>
157
- <view class="rounded-[16rpx] bg-[#f8fafc] p-[12rpx]">
158
- <view class="flex items-center justify-between">
159
- <text class="text-[22rpx] text-[#5c5b7a]">
160
- Error
161
- </text>
162
- <t-switch :value="hasError" @change="onErrorChange" />
163
- </view>
164
- </view>
165
- <view class="rounded-[16rpx] bg-[#f8fafc] p-[12rpx]">
166
- <view class="flex items-center justify-between">
167
- <text class="text-[22rpx] text-[#5c5b7a]">
168
- Round
169
- </text>
170
- <t-switch :value="isRound" @change="onRoundChange" />
171
- </view>
172
- </view>
173
- <view class="rounded-[16rpx] bg-[#f8fafc] p-[12rpx]">
174
- <view class="flex items-center justify-between">
175
- <text class="text-[22rpx] text-[#5c5b7a]">
176
- Ghost
177
- </text>
178
- <t-switch :value="isGhost" @change="onGhostChange" />
179
- </view>
180
- </view>
181
- </view>
182
- <view class="mt-[12rpx] flex flex-wrap gap-[12rpx]">
183
- <t-button size="small" variant="outline" @tap="applyScenarioBase">
184
- Base
185
- </t-button>
186
- <t-button size="small" variant="outline" @tap="applyScenarioAllOn">
187
- All On
188
- </t-button>
189
- <t-button size="small" variant="outline" @tap="applyScenarioMixed">
190
- Mixed
191
- </t-button>
192
- <t-button size="small" variant="outline" @tap="applyScenarioErrorGhost">
193
- Error+Ghost
194
- </t-button>
195
- </view>
196
- </view>
197
-
198
- <view class="mt-[18rpx] space-y-[14rpx]">
199
- <view class="rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
200
- <SectionTitle title="对象语法" subtitle="状态驱动 class" />
201
- <view class="mt-[12rpx] demo-block" data-e2e="class-object" :class="{ 'demo-active': isActive }">
202
- <view>
203
- <text class="block text-[24rpx] font-semibold">
204
- Object Syntax
205
- </text>
206
- <text class="mt-[6rpx] block text-[20rpx] demo-subtext">
207
- active 触发高亮
208
- </text>
209
- </view>
210
- <view class="demo-chip">
211
- Obj
212
- </view>
213
- </view>
214
- </view>
215
-
216
- <view class="rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
217
- <SectionTitle title="静态 + 对象" subtitle="静态 class + 动态对象" />
218
- <view
219
- class="mt-[12rpx] demo-block demo-ghost"
220
- data-e2e="class-static-object"
221
- :class="{ 'demo-active': isActive, 'text-danger': hasError }"
222
- >
223
- <view>
224
- <text class="block text-[24rpx] font-semibold">
225
- Static + Object
226
- </text>
227
- <text class="mt-[6rpx] block text-[20rpx] demo-subtext">
228
- error 显示警示色
229
- </text>
230
- </view>
231
- <view class="demo-chip">
232
- Mix
233
- </view>
234
- </view>
235
- </view>
236
-
237
- <view class="rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
238
- <SectionTitle title="响应式对象" subtitle="reactive classObject" />
239
- <view class="mt-[12rpx] demo-block" data-e2e="class-reactive" :class="classObject">
240
- <view>
241
- <text class="block text-[24rpx] font-semibold">
242
- Reactive Object
243
- </text>
244
- <text class="mt-[6rpx] block text-[20rpx] demo-subtext">
245
- 多状态合并控制
246
- </text>
247
- </view>
248
- <view class="demo-chip">
249
- Obj+
250
- </view>
251
- </view>
252
- </view>
253
-
254
- <view class="rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
255
- <SectionTitle title="数组语法" subtitle="数组传入多个 class" />
256
- <view class="mt-[12rpx] demo-block" data-e2e="class-array" :class="[activeClassIf, errorClassIf, roundClassIf]">
257
- <view>
258
- <text class="block text-[24rpx] font-semibold">
259
- Array Syntax
260
- </text>
261
- <text class="mt-[6rpx] block text-[20rpx] demo-subtext">
262
- 组合多个 class
263
- </text>
264
- </view>
265
- <view class="demo-chip">
266
- Arr
267
- </view>
268
- </view>
269
- </view>
270
-
271
- <view class="rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
272
- <SectionTitle title="数组条件" subtitle="条件判断决定 class" />
273
- <view class="mt-[12rpx] demo-block" data-e2e="class-cond-array" :class="[isActive ? activeClass : '', errorClassIf]">
274
- <view>
275
- <text class="block text-[24rpx] font-semibold">
276
- Conditional Array
277
- </text>
278
- <text class="mt-[6rpx] block text-[20rpx] demo-subtext">
279
- 条件表达式返回 class
280
- </text>
281
- </view>
282
- <view class="demo-chip">
283
- Cond
284
- </view>
285
- </view>
286
- </view>
287
-
288
- <view class="rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
289
- <SectionTitle title="数组 + 动态 key" subtitle="对象 + 字符串混合" />
290
- <view class="mt-[12rpx] demo-block" data-e2e="class-array-key" :class="[dynamicKeyClass, errorClassIf, ghostClassIf]">
291
- <view>
292
- <text class="block text-[24rpx] font-semibold">
293
- Array + Key
294
- </text>
295
- <text class="mt-[6rpx] block text-[20rpx] demo-subtext">
296
- 支持计算属性 key
297
- </text>
298
- </view>
299
- <view class="demo-chip">
300
- Key
301
- </view>
302
- </view>
303
- </view>
304
-
305
- <view class="rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
306
- <SectionTitle title="Style 对象语法" subtitle="对象绑定动态 style" />
307
- <view class="mt-[12rpx] demo-block demo-style-anchor" data-e2e="style-object" :style="styleObject">
308
- <view>
309
- <text class="block text-[24rpx] font-semibold">
310
- Style Object
311
- </text>
312
- <text class="mt-[6rpx] block text-[20rpx] demo-subtext">
313
- 多属性对象绑定
314
- </text>
315
- </view>
316
- <view class="demo-chip">
317
- StyObj
318
- </view>
319
- </view>
320
- </view>
321
-
322
- <view class="rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
323
- <SectionTitle title="Style 数组语法" subtitle="按状态合并样式片段" />
324
- <view class="mt-[12rpx] demo-block demo-style-anchor" data-e2e="style-array" :style="styleArray">
325
- <view>
326
- <text class="block text-[24rpx] font-semibold">
327
- Style Array
328
- </text>
329
- <text class="mt-[6rpx] block text-[20rpx] demo-subtext">
330
- 条件 style 片段
331
- </text>
332
- </view>
333
- <view class="demo-chip">
334
- StyArr
335
- </view>
336
- </view>
337
- </view>
338
-
339
- <view class="rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
340
- <SectionTitle title="Style 字符串语法" subtitle="拼接结果直出字符串" />
341
- <view class="mt-[12rpx] demo-block demo-style-anchor" data-e2e="style-string" :style="styleString">
342
- <view>
343
- <text class="block text-[24rpx] font-semibold">
344
- Style String
345
- </text>
346
- <text class="mt-[6rpx] block text-[20rpx] demo-subtext">
347
- string 绑定与条件拼接
348
- </text>
349
- </view>
350
- <view class="demo-chip">
351
- StyStr
352
- </view>
353
- </view>
354
- </view>
355
-
356
- <view class="rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
357
- <SectionTitle title="Style 变量语法" subtitle="CSS 变量与对象混合" />
358
- <view class="mt-[12rpx] demo-block demo-style-anchor" data-e2e="style-var" :style="styleWithVar">
359
- <view>
360
- <text class="block text-[24rpx] font-semibold">
361
- Style Variable
362
- </text>
363
- <text class="mt-[6rpx] block text-[20rpx] demo-subtext">
364
- 变量透传与消费
365
- </text>
366
- </view>
367
- <view class="demo-chip">
368
- StyVar
369
- </view>
370
- </view>
371
- </view>
372
-
373
- <view class="rounded-[24rpx] bg-[#111827] p-[18rpx] text-white">
374
- <text class="text-[20rpx] text-slate-300">
375
- E2E 状态快照
376
- </text>
377
- <text class="mt-[8rpx] block text-[20rpx]" data-e2e="state-line">
378
- {{ runE2EState() }}
379
- </text>
380
- </view>
381
- </view>
382
- </view>
383
- </template>
384
-
385
- <style scoped>
386
- .demo-block {
387
- display: flex;
388
- align-items: center;
389
- justify-content: space-between;
390
- padding: 20rpx;
391
- color: #1f1a3f;
392
- background: #fff;
393
- border: 2rpx solid #d7d9f2;
394
- border-radius: 18rpx;
395
- transition: all 0.2s ease;
396
- }
397
-
398
- .demo-chip {
399
- padding: 6rpx 16rpx;
400
- font-size: 18rpx;
401
- letter-spacing: 0.5rpx;
402
- border: 2rpx solid currentcolor;
403
- border-radius: 999rpx;
404
- }
405
-
406
- .demo-subtext {
407
- color: currentcolor;
408
- opacity: 0.82;
409
- }
410
-
411
- .demo-ghost {
412
- background: #f8fafc;
413
- border-style: dashed;
414
- }
415
-
416
- .demo-round {
417
- border-radius: 999rpx;
418
- }
419
-
420
- .demo-active {
421
- color: #fff;
422
- background: linear-gradient(135deg, #2563eb, #6366f1);
423
- border-color: #1e40af;
424
- box-shadow: 0 18rpx 32rpx rgb(37 99 235 / 35%);
425
- transform: translateY(-4rpx);
426
- }
427
-
428
- .text-danger {
429
- color: #b91c1c;
430
- background: #fff1f2;
431
- border-color: #ef4444;
432
- box-shadow: 0 18rpx 32rpx rgb(239 68 68 / 20%);
433
- }
434
-
435
- .demo-style-anchor {
436
- border-color: #d7d9f2;
437
- border-style: solid;
438
- border-width: 2rpx;
439
- }
440
- </style>