create-weapp-vite 2.3.14 → 2.3.16
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.
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-JolaD7Ia.js → src-C8kzMXK7.js} +11 -7
- package/package.json +1 -1
- package/templates/default/.vscode/extensions.json +2 -1
- package/templates/default/package.json +3 -0
- package/templates/lib/.vscode/extensions.json +2 -1
- package/templates/lib/package.json +4 -1
- package/templates/plugin/.vscode/extensions.json +7 -0
- package/templates/plugin/package.json +3 -0
- package/templates/tailwindcss/.vscode/extensions.json +2 -1
- package/templates/tailwindcss/package.json +3 -0
- package/templates/tdesign/.vscode/extensions.json +2 -1
- package/templates/tdesign/package.json +3 -0
- package/templates/vant/.vscode/extensions.json +2 -1
- package/templates/vant/package.json +3 -0
- package/templates/wevu/.vscode/extensions.json +2 -1
- package/templates/wevu/README.md +3 -3
- package/templates/wevu/package.json +4 -1
- package/templates/wevu/src/app.vue +1 -60
- package/templates/wevu/src/pages/index/index.vue +26 -194
- package/templates/wevu/src/pages/layouts/index.vue +0 -18
- package/templates/wevu/weapp-vite.config.ts +0 -7
- package/templates/wevu-tdesign/.vscode/extensions.json +2 -1
- package/templates/wevu-tdesign/README.md +3 -6
- package/templates/wevu-tdesign/package.json +4 -1
- package/templates/wevu-tdesign/project.private.config.json +0 -66
- package/templates/wevu-tdesign/src/app.vue +1 -73
- package/templates/wevu-tdesign/src/pages/index/index.vue +19 -362
- package/templates/wevu/src/components/InfoPanel/index.vue +0 -52
- package/templates/wevu/src/components/StatusPill/index.vue +0 -42
- package/templates/wevu/src/packageA/pages/workspace/index.vue +0 -137
- package/templates/wevu/src/packageB/pages/settings/index.vue +0 -131
- package/templates/wevu/src/pages/overview/index.vue +0 -149
- package/templates/wevu-tdesign/public/tabbar/ability-active.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/ability.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/data-active.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/data.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/form-active.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/form.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/home-active.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/home.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/list-active.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/list.png +0 -0
- package/templates/wevu-tdesign/src/components/EmptyState/index.vue +0 -36
- package/templates/wevu-tdesign/src/components/FilterBar/index.vue +0 -64
- package/templates/wevu-tdesign/src/components/FormRow/index.vue +0 -43
- package/templates/wevu-tdesign/src/components/FormStep/index.vue +0 -48
- package/templates/wevu-tdesign/src/components/KpiBoard/index.vue +0 -145
- package/templates/wevu-tdesign/src/components/QuickActionGrid/index.vue +0 -79
- package/templates/wevu-tdesign/src/components/ResultCard/index.vue +0 -51
- package/templates/wevu-tdesign/src/components/SectionTitle/index.vue +0 -34
- package/templates/wevu-tdesign/src/components/TrendCard/index.vue +0 -101
- package/templates/wevu-tdesign/src/components/VirtualHostClassDemo/BrokenCard.vue +0 -46
- package/templates/wevu-tdesign/src/components/VirtualHostClassDemo/FixedExternalClassCard.vue +0 -50
- package/templates/wevu-tdesign/src/components/VirtualHostClassDemo/RecommendedCard.vue +0 -53
- package/templates/wevu-tdesign/src/hooks/useDialog.ts +0 -205
- package/templates/wevu-tdesign/src/hooks/useFormBinder.ts +0 -17
- package/templates/wevu-tdesign/src/hooks/useLayoutFeedbackBridge.ts +0 -17
- package/templates/wevu-tdesign/src/hooks/usePullDownRefresh.ts +0 -12
- package/templates/wevu-tdesign/src/hooks/useToast.ts +0 -100
- package/templates/wevu-tdesign/src/layouts/admin.vue +0 -41
- package/templates/wevu-tdesign/src/layouts/default.vue +0 -23
- package/templates/wevu-tdesign/src/pages/ability/index.vue +0 -164
- package/templates/wevu-tdesign/src/pages/data/index.vue +0 -189
- package/templates/wevu-tdesign/src/pages/form/index.vue +0 -271
- package/templates/wevu-tdesign/src/pages/layout-feedback/components/FeedbackCallerCard.vue +0 -79
- package/templates/wevu-tdesign/src/pages/layout-feedback/index.vue +0 -211
- package/templates/wevu-tdesign/src/pages/layout-store/index.vue +0 -127
- package/templates/wevu-tdesign/src/pages/layouts/index.vue +0 -120
- package/templates/wevu-tdesign/src/pages/list/index.vue +0 -146
- package/templates/wevu-tdesign/src/stores/layoutInteractionDemo.ts +0 -129
- package/templates/wevu-tdesign/src/subpackages/ability/index.vue +0 -103
- package/templates/wevu-tdesign/src/subpackages/lab/class-binding/index.vue +0 -440
- package/templates/wevu-tdesign/src/subpackages/lab/index.vue +0 -169
- package/templates/wevu-tdesign/src/subpackages/lab/virtual-host-class/index.vue +0 -94
- package/templates/wevu-tdesign/src/types/action.ts +0 -14
- package/templates/wevu-tdesign/src/types/list.ts +0 -17
- package/templates/wevu-tdesign/src/utils/changeEvent.ts +0 -53
- package/templates/wevu-tdesign/src/utils/listFilters.ts +0 -34
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ref, setPageLayout } from 'wevu'
|
|
3
|
-
import { useRouter } from 'wevu/router'
|
|
4
3
|
|
|
5
4
|
definePageJson({
|
|
6
5
|
navigationBarTitleText: '页面布局',
|
|
7
6
|
})
|
|
8
7
|
|
|
9
|
-
const router = useRouter()
|
|
10
8
|
const currentLayout = ref<'default' | 'admin' | 'none'>('default')
|
|
11
9
|
|
|
12
10
|
const cards = [
|
|
@@ -41,14 +39,6 @@ function clearLayout() {
|
|
|
41
39
|
currentLayout.value = 'none'
|
|
42
40
|
setPageLayout(false)
|
|
43
41
|
}
|
|
44
|
-
|
|
45
|
-
async function backHome() {
|
|
46
|
-
await router.push('/pages/index/index')
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
definePageJson({
|
|
50
|
-
navigationBarTitleText: '页面布局',
|
|
51
|
-
})
|
|
52
42
|
</script>
|
|
53
43
|
|
|
54
44
|
<template>
|
|
@@ -88,9 +78,6 @@ definePageJson({
|
|
|
88
78
|
<button class="action-btn action-btn--ghost" @tap="clearLayout">
|
|
89
79
|
关闭布局
|
|
90
80
|
</button>
|
|
91
|
-
<button class="action-btn action-btn--light" @tap="backHome">
|
|
92
|
-
返回首页
|
|
93
|
-
</button>
|
|
94
81
|
</view>
|
|
95
82
|
</view>
|
|
96
83
|
</template>
|
|
@@ -161,9 +148,4 @@ definePageJson({
|
|
|
161
148
|
color: #0f172a;
|
|
162
149
|
background: #e2e8f0;
|
|
163
150
|
}
|
|
164
|
-
|
|
165
|
-
.action-btn--light {
|
|
166
|
-
color: #1d4ed8;
|
|
167
|
-
background: #dbeafe;
|
|
168
|
-
}
|
|
169
151
|
</style>
|
|
@@ -4,13 +4,6 @@ export default defineConfig(() => ({
|
|
|
4
4
|
weapp: {
|
|
5
5
|
srcRoot: 'src',
|
|
6
6
|
autoRoutes: true,
|
|
7
|
-
autoImportComponents: true,
|
|
8
|
-
subPackages: {
|
|
9
|
-
packageA: {},
|
|
10
|
-
packageB: {
|
|
11
|
-
independent: true,
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
7
|
},
|
|
15
8
|
// weapp-vite 内置的 Vue 支持会自动处理 .vue 文件,不需要额外插件
|
|
16
9
|
}))
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
# weapp-vite-wevu-template
|
|
2
2
|
|
|
3
|
-
`weapp-vite` + `wevu
|
|
4
|
-
|
|
5
|
-
## 页面结构
|
|
6
|
-
|
|
7
|
-
- TabBar:`首页` / `数据` / `表单` / `清单` / `能力`
|
|
8
|
-
- 子包:`组件实验室`(subpackages/lab)与 `API 场景`(subpackages/ability)
|
|
3
|
+
`weapp-vite` + `wevu` + `TDesign` + `Tailwind CSS` 最小模板。
|
|
9
4
|
|
|
10
5
|
## 使用方式
|
|
11
6
|
|
|
@@ -19,6 +14,8 @@
|
|
|
19
14
|
|
|
20
15
|
- 页面/组件优先使用 Vue `<script setup>`(编译宏)写法
|
|
21
16
|
- 配置使用 `<json>` 自定义块
|
|
17
|
+
- TDesign 组件通过 `TDesignResolver()` 自动导入
|
|
18
|
+
- 复杂页面、layout feedback、class/style 绑定等验证性示例在 `e2e-apps/template-wevu-tdesign-regression`
|
|
22
19
|
|
|
23
20
|
### 构建
|
|
24
21
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-vite-wevu-tailwindcss-tdesign-template",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.7",
|
|
5
5
|
"private": true,
|
|
6
6
|
"description": "weapp-vite + wevu (Vue SFC) 模板",
|
|
7
7
|
"author": "ice breaker <1324318532@qq.com>",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"dev": "wv dev",
|
|
20
20
|
"dev:open": "wv dev -o",
|
|
21
|
+
"dev:ui": "wv dev --ui",
|
|
22
|
+
"dev:open:ui": "wv dev --ui -o",
|
|
21
23
|
"build": "wv build",
|
|
22
24
|
"lint": "eslint .",
|
|
23
25
|
"lint:fix": "eslint . --fix",
|
|
@@ -37,6 +39,7 @@
|
|
|
37
39
|
"@iconify-json/mdi": "catalog:",
|
|
38
40
|
"@tailwindcss/postcss": "catalog:",
|
|
39
41
|
"@types/node": "catalog:",
|
|
42
|
+
"@weapp-vite/dashboard": "workspace:*",
|
|
40
43
|
"autoprefixer": "catalog:",
|
|
41
44
|
"eslint": "catalog:",
|
|
42
45
|
"miniprogram-api-typings": "catalog:",
|
|
@@ -12,72 +12,6 @@
|
|
|
12
12
|
"pathName": "pages/index/index",
|
|
13
13
|
"query": "",
|
|
14
14
|
"scene": null
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"name": "布局页",
|
|
18
|
-
"pathName": "pages/layouts/index",
|
|
19
|
-
"query": "",
|
|
20
|
-
"scene": null
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"name": "Layout 通信演示",
|
|
24
|
-
"pathName": "pages/layout-feedback/index",
|
|
25
|
-
"query": "",
|
|
26
|
-
"scene": null
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"name": "Store 调用 Layout",
|
|
30
|
-
"pathName": "pages/layout-store/index",
|
|
31
|
-
"query": "",
|
|
32
|
-
"scene": null
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"name": "数据页",
|
|
36
|
-
"pathName": "pages/data/index",
|
|
37
|
-
"query": "",
|
|
38
|
-
"scene": null
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"name": "表单页",
|
|
42
|
-
"pathName": "pages/form/index",
|
|
43
|
-
"query": "",
|
|
44
|
-
"scene": null
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"name": "清单页",
|
|
48
|
-
"pathName": "pages/list/index",
|
|
49
|
-
"query": "",
|
|
50
|
-
"scene": null
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"name": "能力页",
|
|
54
|
-
"pathName": "pages/ability/index",
|
|
55
|
-
"query": "",
|
|
56
|
-
"scene": null
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"name": "组件实验室",
|
|
60
|
-
"pathName": "subpackages/lab/index",
|
|
61
|
-
"query": "",
|
|
62
|
-
"scene": null
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"name": "Class 绑定实验室",
|
|
66
|
-
"pathName": "subpackages/lab/class-binding/index",
|
|
67
|
-
"query": "",
|
|
68
|
-
"scene": null
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"name": "virtualHost class 透传实验",
|
|
72
|
-
"pathName": "subpackages/lab/virtual-host-class/index",
|
|
73
|
-
"query": "",
|
|
74
|
-
"scene": null
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"name": "系统能力页",
|
|
78
|
-
"pathName": "subpackages/ability/index",
|
|
79
|
-
"query": "",
|
|
80
|
-
"scene": null
|
|
81
15
|
}
|
|
82
16
|
]
|
|
83
17
|
}
|
|
@@ -1,90 +1,18 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { onHide, onLaunch, onShow } from 'wevu'
|
|
3
|
-
import { wpi } from 'wevu/api'
|
|
4
|
-
|
|
5
2
|
defineAppJson({
|
|
6
3
|
pages: [
|
|
7
4
|
'pages/index/index',
|
|
8
|
-
'pages/layouts/index',
|
|
9
|
-
'pages/layout-store/index',
|
|
10
|
-
'pages/layout-feedback/index',
|
|
11
|
-
'pages/data/index',
|
|
12
|
-
'pages/form/index',
|
|
13
|
-
'pages/list/index',
|
|
14
|
-
'pages/ability/index',
|
|
15
5
|
],
|
|
16
6
|
window: {
|
|
17
|
-
navigationBarTitleText: '
|
|
7
|
+
navigationBarTitleText: 'TDesign 模板',
|
|
18
8
|
navigationBarBackgroundColor: '#2f2b5f',
|
|
19
9
|
navigationBarTextStyle: 'white',
|
|
20
10
|
backgroundTextStyle: 'dark',
|
|
21
11
|
},
|
|
22
|
-
tabBar: {
|
|
23
|
-
color: '#7a7aa0',
|
|
24
|
-
selectedColor: '#2f2b5f',
|
|
25
|
-
backgroundColor: '#ffffff',
|
|
26
|
-
borderStyle: 'white',
|
|
27
|
-
list: [
|
|
28
|
-
{
|
|
29
|
-
pagePath: 'pages/index/index',
|
|
30
|
-
text: '首页',
|
|
31
|
-
iconPath: 'tabbar/home.png',
|
|
32
|
-
selectedIconPath: 'tabbar/home-active.png',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
pagePath: 'pages/data/index',
|
|
36
|
-
text: '数据',
|
|
37
|
-
iconPath: 'tabbar/data.png',
|
|
38
|
-
selectedIconPath: 'tabbar/data-active.png',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
pagePath: 'pages/form/index',
|
|
42
|
-
text: '表单',
|
|
43
|
-
iconPath: 'tabbar/form.png',
|
|
44
|
-
selectedIconPath: 'tabbar/form-active.png',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
pagePath: 'pages/list/index',
|
|
48
|
-
text: '清单',
|
|
49
|
-
iconPath: 'tabbar/list.png',
|
|
50
|
-
selectedIconPath: 'tabbar/list-active.png',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
pagePath: 'pages/ability/index',
|
|
54
|
-
text: '能力',
|
|
55
|
-
iconPath: 'tabbar/ability.png',
|
|
56
|
-
selectedIconPath: 'tabbar/ability-active.png',
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
subPackages: [
|
|
61
|
-
{
|
|
62
|
-
root: 'subpackages/lab',
|
|
63
|
-
pages: ['index', 'class-binding/index', 'virtual-host-class/index'],
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
root: 'subpackages/ability',
|
|
67
|
-
pages: ['index'],
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
12
|
style: 'v2',
|
|
71
13
|
componentFramework: 'glass-easel',
|
|
72
14
|
sitemapLocation: 'sitemap.json',
|
|
73
15
|
})
|
|
74
|
-
|
|
75
|
-
const logger = wpi.getLogManager({ level: 1 })
|
|
76
|
-
|
|
77
|
-
onShow(() => {
|
|
78
|
-
logger.info('[weapp-vite-wevu-template] app show')
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
onHide(() => {
|
|
82
|
-
logger.info('[weapp-vite-wevu-template] app hide')
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
onLaunch(() => {
|
|
86
|
-
logger.info('[weapp-vite-wevu-template] app launch')
|
|
87
|
-
})
|
|
88
16
|
</script>
|
|
89
17
|
|
|
90
18
|
<style src="./app.css"></style>
|
|
@@ -1,380 +1,37 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import { computed, getCurrentInstance, ref, resolveLayoutBridge, resolveLayoutHost, watch } from 'wevu'
|
|
5
|
-
import { wpi } from 'wevu/api'
|
|
6
|
-
import KpiBoard from '@/components/KpiBoard/index.vue'
|
|
7
|
-
import QuickActionGrid from '@/components/QuickActionGrid/index.vue'
|
|
8
|
-
import { LAYOUT_TOAST_BRIDGE_KEY } from '@/hooks/useLayoutFeedbackBridge'
|
|
9
|
-
import { usePullDownRefresh } from '@/hooks/usePullDownRefresh'
|
|
10
|
-
import { useToast } from '@/hooks/useToast'
|
|
2
|
+
import { computed, ref } from 'wevu'
|
|
11
3
|
|
|
12
4
|
definePageJson({
|
|
13
|
-
navigationBarTitleText: '
|
|
14
|
-
enablePullDownRefresh: true,
|
|
5
|
+
navigationBarTitleText: 'TDesign 模板',
|
|
15
6
|
backgroundColor: '#f6f7fb',
|
|
16
7
|
})
|
|
17
8
|
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const noticeText = ref('欢迎体验 wevu + weapp-vite + TDesign 模板,已启用分包与多页面导航。')
|
|
22
|
-
const lastUpdated = ref('刚刚')
|
|
23
|
-
const refreshSeed = ref(1)
|
|
24
|
-
|
|
25
|
-
const kpiItems = computed(() => {
|
|
26
|
-
const seed = refreshSeed.value
|
|
27
|
-
return [
|
|
28
|
-
{
|
|
29
|
-
key: 'visits',
|
|
30
|
-
label: '今日访问',
|
|
31
|
-
value: 1280 + seed * 3,
|
|
32
|
-
unit: '次',
|
|
33
|
-
delta: 6 + seed,
|
|
34
|
-
footnote: '较昨日',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
key: 'conversion',
|
|
38
|
-
label: '转化率',
|
|
39
|
-
value: 24 + seed,
|
|
40
|
-
unit: '%',
|
|
41
|
-
delta: 2,
|
|
42
|
-
footnote: '近 7 日',
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
key: 'tickets',
|
|
46
|
-
label: '待处理',
|
|
47
|
-
value: 18 - seed,
|
|
48
|
-
unit: '单',
|
|
49
|
-
delta: -1,
|
|
50
|
-
footnote: '来自清单',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
key: 'satisfaction',
|
|
54
|
-
label: '满意度',
|
|
55
|
-
value: 4.8,
|
|
56
|
-
unit: '分',
|
|
57
|
-
delta: 0.2,
|
|
58
|
-
footnote: '客服评分',
|
|
59
|
-
},
|
|
60
|
-
]
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
const quickActions = ref<QuickActionItem[]>([
|
|
64
|
-
{
|
|
65
|
-
key: 'data',
|
|
66
|
-
title: '数据洞察',
|
|
67
|
-
description: '仪表盘与趋势',
|
|
68
|
-
icon: 'chart-analytics',
|
|
69
|
-
tag: 'KPI',
|
|
70
|
-
tone: 'brand',
|
|
71
|
-
path: '/pages/data/index',
|
|
72
|
-
type: 'tab',
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
key: 'form',
|
|
76
|
-
title: '流程表单',
|
|
77
|
-
description: '多步录入',
|
|
78
|
-
icon: 'edit-1',
|
|
79
|
-
tag: 'Flow',
|
|
80
|
-
tone: 'neutral',
|
|
81
|
-
path: '/pages/form/index',
|
|
82
|
-
type: 'tab',
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
key: 'list',
|
|
86
|
-
title: '清单看板',
|
|
87
|
-
description: '筛选与列表',
|
|
88
|
-
icon: 'view-list',
|
|
89
|
-
tag: 'List',
|
|
90
|
-
tone: 'neutral',
|
|
91
|
-
path: '/pages/list/index',
|
|
92
|
-
type: 'tab',
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
key: 'ability',
|
|
96
|
-
title: '能力中心',
|
|
97
|
-
description: '小程序 API',
|
|
98
|
-
icon: 'app',
|
|
99
|
-
tag: 'API',
|
|
100
|
-
tone: 'brand',
|
|
101
|
-
path: '/pages/ability/index',
|
|
102
|
-
type: 'tab',
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
key: 'layouts',
|
|
106
|
-
title: '布局能力',
|
|
107
|
-
description: 'default / admin / false',
|
|
108
|
-
icon: 'layers',
|
|
109
|
-
tag: 'Layout',
|
|
110
|
-
tone: 'brand',
|
|
111
|
-
path: '/pages/layouts/index',
|
|
112
|
-
type: 'sub',
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
key: 'layout-feedback',
|
|
116
|
-
title: 'Layout 通信',
|
|
117
|
-
description: '页面/组件调用 layout',
|
|
118
|
-
icon: 'chat-bubble',
|
|
119
|
-
tag: 'Bridge',
|
|
120
|
-
tone: 'brand',
|
|
121
|
-
path: '/pages/layout-feedback/index',
|
|
122
|
-
type: 'sub',
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
key: 'layout-store',
|
|
126
|
-
title: 'Store 调用 Layout',
|
|
127
|
-
description: 'store 驱动 layout 宿主',
|
|
128
|
-
icon: 'layers',
|
|
129
|
-
tag: 'Store',
|
|
130
|
-
tone: 'brand',
|
|
131
|
-
path: '/pages/layout-store/index',
|
|
132
|
-
type: 'sub',
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
key: 'lab',
|
|
136
|
-
title: '组件实验室',
|
|
137
|
-
description: 'TDesign 组件',
|
|
138
|
-
icon: 'grid-view',
|
|
139
|
-
tag: 'Lab',
|
|
140
|
-
tone: 'neutral',
|
|
141
|
-
path: '/subpackages/lab/index',
|
|
142
|
-
type: 'sub',
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
key: 'class-binding',
|
|
146
|
-
title: 'Class 绑定',
|
|
147
|
-
description: '对象/数组语法',
|
|
148
|
-
icon: 'grid-view',
|
|
149
|
-
tag: 'Vue',
|
|
150
|
-
tone: 'brand',
|
|
151
|
-
path: '/subpackages/lab/class-binding/index',
|
|
152
|
-
type: 'sub',
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
key: 'ability-lab',
|
|
156
|
-
title: 'API 场景',
|
|
157
|
-
description: '系统信息',
|
|
158
|
-
icon: 'share',
|
|
159
|
-
tag: 'Sub',
|
|
160
|
-
tone: 'neutral',
|
|
161
|
-
path: '/subpackages/ability/index',
|
|
162
|
-
type: 'sub',
|
|
163
|
-
},
|
|
164
|
-
])
|
|
165
|
-
|
|
166
|
-
const featureTags = [
|
|
167
|
-
'Composition API',
|
|
168
|
-
'SubPackages',
|
|
169
|
-
'Auto Import',
|
|
170
|
-
'Tailwind',
|
|
171
|
-
]
|
|
172
|
-
|
|
173
|
-
watch(refreshSeed, () => {
|
|
174
|
-
lastUpdated.value = `更新于 ${new Date().toLocaleTimeString()}`
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
function nextRefreshSeedValue() {
|
|
178
|
-
return refreshSeed.value >= 9 ? 1 : refreshSeed.value + 1
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
function refreshDashboard() {
|
|
182
|
-
refreshSeed.value = nextRefreshSeedValue()
|
|
183
|
-
showToast('指标已刷新')
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
function inspectLayoutToastBridge() {
|
|
187
|
-
const bridge = resolveLayoutBridge(LAYOUT_TOAST_BRIDGE_KEY, pageInstance)
|
|
188
|
-
const layoutByPage = pageInstance?.selectComponent?.('weapp-layout-default')
|
|
189
|
-
?? pageInstance?.selectComponent?.('.weapp-layout-default')
|
|
190
|
-
?? null
|
|
191
|
-
const toastFromBridge = resolveLayoutHost(LAYOUT_TOAST_BRIDGE_KEY, { context: pageInstance })
|
|
192
|
-
|
|
193
|
-
return {
|
|
194
|
-
bridgeResolved: Boolean(bridge),
|
|
195
|
-
bridgeIsPage: bridge === pageInstance,
|
|
196
|
-
bridgeHasSelectComponent: typeof bridge?.selectComponent === 'function',
|
|
197
|
-
layoutFoundByPage: Boolean(layoutByPage),
|
|
198
|
-
toastFoundByBridge: Boolean(toastFromBridge),
|
|
199
|
-
bridgeKeys: bridge ? Object.keys(bridge).slice(0, 20) : [],
|
|
200
|
-
layoutKeys: layoutByPage ? Object.keys(layoutByPage).slice(0, 20) : [],
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
void inspectLayoutToastBridge
|
|
205
|
-
|
|
206
|
-
function runLayoutToastE2E() {
|
|
207
|
-
refreshSeed.value = nextRefreshSeedValue()
|
|
208
|
-
const bridgeState = inspectLayoutToastBridge()
|
|
209
|
-
setTimeout(() => {
|
|
210
|
-
showToast('指标已刷新')
|
|
211
|
-
}, 0)
|
|
212
|
-
return {
|
|
213
|
-
...bridgeState,
|
|
214
|
-
refreshSeed: refreshSeed.value,
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
void runLayoutToastE2E
|
|
219
|
-
|
|
220
|
-
usePullDownRefresh(refreshDashboard)
|
|
221
|
-
|
|
222
|
-
async function onQuickAction(action: QuickActionItem) {
|
|
223
|
-
if (!action.path) {
|
|
224
|
-
showToast('该入口暂未配置')
|
|
225
|
-
return
|
|
226
|
-
}
|
|
227
|
-
if (action.type === 'tab') {
|
|
228
|
-
await wpi.switchTab({
|
|
229
|
-
url: action.path,
|
|
230
|
-
})
|
|
231
|
-
return
|
|
232
|
-
}
|
|
233
|
-
await wpi.navigateTo({
|
|
234
|
-
url: action.path,
|
|
235
|
-
})
|
|
236
|
-
}
|
|
9
|
+
const count = ref(0)
|
|
10
|
+
const buttonText = computed(() => `已点击 ${count.value} 次`)
|
|
237
11
|
</script>
|
|
238
12
|
|
|
239
13
|
<template>
|
|
240
|
-
<view class="min-h-screen bg-[#f6f7fb] px-[28rpx]
|
|
241
|
-
<view class="rounded-[28rpx] bg-
|
|
242
|
-
<
|
|
243
|
-
|
|
244
|
-
</
|
|
245
|
-
<
|
|
246
|
-
|
|
247
|
-
</text>
|
|
248
|
-
<view class="mt-[12rpx] flex flex-wrap gap-[8rpx]">
|
|
249
|
-
<t-tag v-for="tag in featureTags" :key="tag" size="small" theme="primary" variant="dark">
|
|
250
|
-
{{ tag }}
|
|
251
|
-
</t-tag>
|
|
14
|
+
<view class="min-h-screen bg-[#f6f7fb] px-[28rpx] py-[32rpx] text-[#1f1a3f]">
|
|
15
|
+
<view class="rounded-[28rpx] bg-white p-[28rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
|
|
16
|
+
<t-tag theme="primary" variant="light">
|
|
17
|
+
wevu
|
|
18
|
+
</t-tag>
|
|
19
|
+
<view class="mt-[16rpx] text-[38rpx] font-semibold">
|
|
20
|
+
TDesign 最小模板
|
|
252
21
|
</view>
|
|
253
|
-
<view class="mt-[
|
|
254
|
-
|
|
255
|
-
{{ lastUpdated }}
|
|
256
|
-
</text>
|
|
257
|
-
<view id="refresh-dashboard-trigger" @tap="refreshDashboard">
|
|
258
|
-
<t-button size="small" theme="default" variant="outline">
|
|
259
|
-
刷新指标
|
|
260
|
-
</t-button>
|
|
261
|
-
</view>
|
|
22
|
+
<view class="mt-[12rpx] text-[24rpx] leading-[1.6] text-[#64748b]">
|
|
23
|
+
保留 Vue SFC、Tailwind CSS 与 TDesign 自动导入的最小组合,复杂验证场景已迁到 e2e-apps。
|
|
262
24
|
</view>
|
|
263
|
-
</view>
|
|
264
|
-
|
|
265
|
-
<view class="mt-[16rpx]">
|
|
266
|
-
<t-notice-bar theme="info" :content="noticeText" />
|
|
267
|
-
</view>
|
|
268
|
-
|
|
269
|
-
<view class="mt-[20rpx]">
|
|
270
|
-
<KpiBoard title="今日概览" subtitle="实时跟踪业务健康度" :items="kpiItems">
|
|
271
|
-
<template #action>
|
|
272
|
-
<t-button size="small" theme="primary" variant="outline" @tap="refreshDashboard">
|
|
273
|
-
重新计算
|
|
274
|
-
</t-button>
|
|
275
|
-
</template>
|
|
276
|
-
<template #items="{ items }">
|
|
277
|
-
<view v-for="card in items" :key="card.key" class="rounded-[18rpx] bg-[#f4f6ff] p-[16rpx]">
|
|
278
|
-
<view class="flex items-center justify-between">
|
|
279
|
-
<text class="text-[22rpx] text-[#51517c]">
|
|
280
|
-
{{ card.item.label }}
|
|
281
|
-
</text>
|
|
282
|
-
<t-tag v-if="card.isLeading" size="small" theme="warning" variant="light">
|
|
283
|
-
热点
|
|
284
|
-
</t-tag>
|
|
285
|
-
</view>
|
|
286
|
-
<view class="mt-[12rpx] flex items-end justify-between">
|
|
287
|
-
<view class="flex items-baseline gap-[6rpx]">
|
|
288
|
-
<text class="text-[32rpx] font-semibold text-[#1f1a3f]">
|
|
289
|
-
{{ card.item.value }}
|
|
290
|
-
</text>
|
|
291
|
-
<text v-if="card.item.unit" class="text-[20rpx] text-[#7a7aa0]">
|
|
292
|
-
{{ card.item.unit }}
|
|
293
|
-
</text>
|
|
294
|
-
</view>
|
|
295
|
-
<text
|
|
296
|
-
class="text-[20rpx] font-semibold"
|
|
297
|
-
:class="card.tone === 'positive' ? 'text-[#1b7a3a]' : card.tone === 'negative' ? 'text-[#b42318]' : 'text-[#64748b]'"
|
|
298
|
-
>
|
|
299
|
-
{{ card.tone === 'positive' ? '↑' : card.tone === 'negative' ? '↓' : '→' }}
|
|
300
|
-
{{ card.item.delta ?? '--' }}
|
|
301
|
-
</text>
|
|
302
|
-
</view>
|
|
303
|
-
<text v-if="card.item.footnote" class="mt-[6rpx] block text-[20rpx] text-[#7a7aa0]">
|
|
304
|
-
{{ card.item.footnote }}
|
|
305
|
-
</text>
|
|
306
|
-
</view>
|
|
307
|
-
</template>
|
|
308
|
-
</KpiBoard>
|
|
309
|
-
</view>
|
|
310
25
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
subtitle="覆盖主包与分包页面"
|
|
315
|
-
:items="quickActions"
|
|
316
|
-
@select="onQuickAction"
|
|
317
|
-
/>
|
|
318
|
-
</view>
|
|
319
|
-
|
|
320
|
-
<view class="mt-[20rpx] rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
|
|
321
|
-
<view class="flex items-center justify-between">
|
|
322
|
-
<text class="text-[26rpx] font-semibold text-[#1f1a3f]">
|
|
323
|
-
Class 绑定示例
|
|
26
|
+
<view class="mt-[24rpx] rounded-[20rpx] bg-[#f4f6ff] p-[20rpx]">
|
|
27
|
+
<text class="text-[24rpx] text-[#51517c]">
|
|
28
|
+
{{ buttonText }}
|
|
324
29
|
</text>
|
|
325
|
-
<t-tag size="small" theme="primary" variant="light">
|
|
326
|
-
模板
|
|
327
|
-
</t-tag>
|
|
328
30
|
</view>
|
|
329
|
-
<view class="mt-[12rpx] flex flex-col gap-[12rpx]">
|
|
330
|
-
<view
|
|
331
|
-
class="rounded-[16rpx] px-[16rpx] py-[12rpx] text-[20rpx]"
|
|
332
|
-
:class="{
|
|
333
|
-
'bg-[#eef2ff]': refreshSeed % 2 === 0,
|
|
334
|
-
'text-[#1f1a3f]': refreshSeed % 2 === 0,
|
|
335
|
-
'bg-[#fff7ed]': refreshSeed % 2 !== 0,
|
|
336
|
-
'text-[#92400e]': refreshSeed % 2 !== 0,
|
|
337
|
-
'ring-2 ring-[#6366f1]': refreshSeed % 3 === 0,
|
|
338
|
-
}"
|
|
339
|
-
>
|
|
340
|
-
对象语法:根据刷新次数切换配色与高亮
|
|
341
|
-
</view>
|
|
342
|
-
<view
|
|
343
|
-
class="rounded-[16rpx] px-[16rpx] py-[12rpx] text-[20rpx]" :class="[
|
|
344
|
-
refreshSeed % 2 === 0 ? 'bg-[#ecfeff] text-[#0f766e]' : 'bg-[#fef2f2] text-[#991b1b]',
|
|
345
|
-
refreshSeed % 4 === 0
|
|
346
|
-
? 'shadow-[0_10rpx_18rpx_rgba(15,118,110,0.18)]'
|
|
347
|
-
: 'shadow-[0_10rpx_18rpx_rgba(153,27,27,0.18)]',
|
|
348
|
-
]"
|
|
349
|
-
>
|
|
350
|
-
数组语法:组合静态与条件 class
|
|
351
|
-
</view>
|
|
352
|
-
<view
|
|
353
|
-
class="rounded-[16rpx] border border-[#e2e8f0] px-[16rpx] py-[12rpx] text-[20rpx]"
|
|
354
|
-
:class="refreshSeed % 2 === 0 ? 'bg-[#f8fafc] text-[#334155]' : 'bg-[#111827] text-white'"
|
|
355
|
-
>
|
|
356
|
-
class + :class 合并:静态边框叠加动态背景
|
|
357
|
-
</view>
|
|
358
|
-
</view>
|
|
359
|
-
</view>
|
|
360
31
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
体验清单
|
|
365
|
-
</text>
|
|
366
|
-
<t-tag size="small" theme="primary" variant="light">
|
|
367
|
-
指南
|
|
368
|
-
</t-tag>
|
|
369
|
-
</view>
|
|
370
|
-
<view class="mt-[12rpx]">
|
|
371
|
-
<t-cell-group>
|
|
372
|
-
<t-cell title="多页面 TabBar" note="首页/数据/表单/清单/能力" />
|
|
373
|
-
<t-cell title="分包加载" note="组件实验室与 API 场景" />
|
|
374
|
-
<t-cell title="Composition API" note="ref/computed/watch 驱动" />
|
|
375
|
-
<t-cell title="TDesign 组件" note="表单、列表、反馈" />
|
|
376
|
-
</t-cell-group>
|
|
377
|
-
</view>
|
|
32
|
+
<t-button class="mt-[24rpx]" theme="primary" block @tap="count += 1">
|
|
33
|
+
点一下
|
|
34
|
+
</t-button>
|
|
378
35
|
</view>
|
|
379
36
|
</view>
|
|
380
37
|
</template>
|