create-weapp-vite 2.3.15 → 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-D8uqfCKh.js → src-C8kzMXK7.js} +1 -1
- package/package.json +1 -1
- package/templates/wevu/README.md +3 -3
- package/templates/wevu/package.json +1 -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/README.md +3 -6
- package/templates/wevu-tdesign/package.json +1 -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,120 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { ref, setPageLayout } from 'wevu'
|
|
3
|
-
import { wpi } from 'wevu/api'
|
|
4
|
-
|
|
5
|
-
import SectionTitle from '@/components/SectionTitle/index.vue'
|
|
6
|
-
import { useToast } from '@/hooks/useToast'
|
|
7
|
-
|
|
8
|
-
definePageJson({
|
|
9
|
-
navigationBarTitleText: '布局',
|
|
10
|
-
backgroundColor: '#f6f7fb',
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
const { showToast } = useToast()
|
|
14
|
-
const currentLayout = ref<'default' | 'admin' | 'none'>('default')
|
|
15
|
-
|
|
16
|
-
const cards = [
|
|
17
|
-
{
|
|
18
|
-
key: 'default',
|
|
19
|
-
title: 'default 布局',
|
|
20
|
-
desc: '页面未声明 layout 时,会自动命中 src/layouts/default.vue。',
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
key: 'admin',
|
|
24
|
-
title: 'admin 布局',
|
|
25
|
-
desc: '通过 setPageLayout(\'admin\') 切换到命名布局,并把 title/subtitle 作为 props 传给布局组件。',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
key: 'none',
|
|
29
|
-
title: '关闭布局',
|
|
30
|
-
desc: '通过 setPageLayout(false) 临时移除页面壳,用于沉浸式页或特殊根结构。',
|
|
31
|
-
},
|
|
32
|
-
]
|
|
33
|
-
|
|
34
|
-
function applyDefaultLayout() {
|
|
35
|
-
currentLayout.value = 'default'
|
|
36
|
-
setPageLayout('default')
|
|
37
|
-
showToast('已切回 default 布局')
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function applyAdminLayout() {
|
|
41
|
-
currentLayout.value = 'admin'
|
|
42
|
-
setPageLayout('admin', {
|
|
43
|
-
title: 'Studio Admin',
|
|
44
|
-
subtitle: '这个标题来自 setPageLayout() 运行时传入的 props。',
|
|
45
|
-
})
|
|
46
|
-
showToast('已切换到 admin 布局')
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function clearLayout() {
|
|
50
|
-
currentLayout.value = 'none'
|
|
51
|
-
setPageLayout(false)
|
|
52
|
-
showToast('已关闭布局')
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async function openLayoutFeedbackDemo() {
|
|
56
|
-
await wpi.navigateTo({
|
|
57
|
-
url: '/pages/layout-feedback/index',
|
|
58
|
-
})
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async function openLayoutStoreDemo() {
|
|
62
|
-
await wpi.navigateTo({
|
|
63
|
-
url: '/pages/layout-store/index',
|
|
64
|
-
})
|
|
65
|
-
}
|
|
66
|
-
</script>
|
|
67
|
-
|
|
68
|
-
<template>
|
|
69
|
-
<view class="min-h-screen bg-[#f6f7fb] px-[28rpx] pb-[88rpx] pt-[24rpx] text-[#1c1c3c]">
|
|
70
|
-
<view class="rounded-[28rpx] bg-linear-to-br from-[#eef2ff] via-[#ffffff] to-[#ede9fe] p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.06)]">
|
|
71
|
-
<SectionTitle title="页面布局能力" subtitle="基础模板已接入 src/layouts 目录约定" />
|
|
72
|
-
<text class="mt-[12rpx] block text-[22rpx] leading-[1.7] text-[#5b5b7b]">
|
|
73
|
-
当前状态:{{ currentLayout }}。可在 default、admin 与 false 三种模式之间切换,用来承接后台页、运营页或沉浸式页面。
|
|
74
|
-
</text>
|
|
75
|
-
</view>
|
|
76
|
-
|
|
77
|
-
<view class="mt-[18rpx] flex flex-col gap-[14rpx]">
|
|
78
|
-
<view
|
|
79
|
-
v-for="item in cards"
|
|
80
|
-
:key="item.key"
|
|
81
|
-
class="rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]"
|
|
82
|
-
>
|
|
83
|
-
<text class="text-[28rpx] font-semibold text-[#1f1a3f]">
|
|
84
|
-
{{ item.title }}
|
|
85
|
-
</text>
|
|
86
|
-
<text class="mt-[10rpx] block text-[22rpx] leading-[1.7] text-[#6f6b8a]">
|
|
87
|
-
{{ item.desc }}
|
|
88
|
-
</text>
|
|
89
|
-
</view>
|
|
90
|
-
</view>
|
|
91
|
-
|
|
92
|
-
<view class="mt-[18rpx] rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
|
|
93
|
-
<SectionTitle title="切换布局" subtitle="运行时调用 setPageLayout()" />
|
|
94
|
-
<view class="mt-[14rpx] flex flex-col gap-[12rpx]">
|
|
95
|
-
<t-button block theme="primary" @tap="applyDefaultLayout">
|
|
96
|
-
使用 default 布局
|
|
97
|
-
</t-button>
|
|
98
|
-
<t-button block theme="primary" variant="outline" @tap="applyAdminLayout">
|
|
99
|
-
切到 admin 布局
|
|
100
|
-
</t-button>
|
|
101
|
-
<t-button block theme="danger" variant="outline" @tap="clearLayout">
|
|
102
|
-
关闭布局
|
|
103
|
-
</t-button>
|
|
104
|
-
</view>
|
|
105
|
-
</view>
|
|
106
|
-
|
|
107
|
-
<view class="mt-[18rpx] rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
|
|
108
|
-
<SectionTitle title="通信演示" subtitle="查看页面/组件如何直接使用 layout 里的反馈宿主" />
|
|
109
|
-
<text class="mt-[12rpx] block text-[22rpx] leading-[1.7] text-[#6f6b8a]">
|
|
110
|
-
演示页会同时展示页面调用和子组件调用,它们都只依赖 useToast() / useDialog(),不会直接操作 layout 实例。
|
|
111
|
-
</text>
|
|
112
|
-
<t-button class="mt-[16rpx]" block theme="primary" variant="outline" @tap="openLayoutFeedbackDemo">
|
|
113
|
-
打开 Layout 通信演示
|
|
114
|
-
</t-button>
|
|
115
|
-
<t-button class="mt-[12rpx]" block theme="primary" variant="outline" @tap="openLayoutStoreDemo">
|
|
116
|
-
打开 Store 驱动 Layout 演示
|
|
117
|
-
</t-button>
|
|
118
|
-
</view>
|
|
119
|
-
</view>
|
|
120
|
-
</template>
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { ListItem, StatusFilter, StatusFilterValue } from '@/types/list'
|
|
3
|
-
|
|
4
|
-
import { computed, ref, watch } from 'wevu'
|
|
5
|
-
import EmptyState from '@/components/EmptyState/index.vue'
|
|
6
|
-
import FilterBar from '@/components/FilterBar/index.vue'
|
|
7
|
-
import SectionTitle from '@/components/SectionTitle/index.vue'
|
|
8
|
-
import { usePullDownRefresh } from '@/hooks/usePullDownRefresh'
|
|
9
|
-
import { useToast } from '@/hooks/useToast'
|
|
10
|
-
import { buildStatusFilters, filterListItems } from '@/utils/listFilters'
|
|
11
|
-
|
|
12
|
-
definePageJson({
|
|
13
|
-
navigationBarTitleText: '清单',
|
|
14
|
-
backgroundColor: '#f6f7fb',
|
|
15
|
-
enablePullDownRefresh: true,
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
const { showToast } = useToast({ duration: 1000 })
|
|
19
|
-
|
|
20
|
-
const query = ref('')
|
|
21
|
-
const activeStatus = ref<StatusFilterValue>('all')
|
|
22
|
-
const loading = ref(true)
|
|
23
|
-
|
|
24
|
-
const items = ref<ListItem[]>([
|
|
25
|
-
{
|
|
26
|
-
id: 1,
|
|
27
|
-
title: '门店会员激活方案',
|
|
28
|
-
owner: '王凯',
|
|
29
|
-
status: 'processing',
|
|
30
|
-
deadline: '今日 18:00',
|
|
31
|
-
priority: 'P0',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
id: 2,
|
|
35
|
-
title: '社群内容排期',
|
|
36
|
-
owner: '林鹤',
|
|
37
|
-
status: 'pending',
|
|
38
|
-
deadline: '明日 12:00',
|
|
39
|
-
priority: 'P1',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
id: 3,
|
|
43
|
-
title: '新客任务提醒',
|
|
44
|
-
owner: '陈一',
|
|
45
|
-
status: 'done',
|
|
46
|
-
deadline: '已完成',
|
|
47
|
-
priority: 'P2',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
id: 4,
|
|
51
|
-
title: '客服脚本优化',
|
|
52
|
-
owner: '韩逸',
|
|
53
|
-
status: 'processing',
|
|
54
|
-
deadline: '周五 20:00',
|
|
55
|
-
priority: 'P1',
|
|
56
|
-
},
|
|
57
|
-
])
|
|
58
|
-
|
|
59
|
-
const statusFilters = ref<StatusFilter[]>([])
|
|
60
|
-
|
|
61
|
-
function rebuildStatusFilters() {
|
|
62
|
-
statusFilters.value = buildStatusFilters(items.value)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
rebuildStatusFilters()
|
|
66
|
-
watch(items, rebuildStatusFilters, { deep: true })
|
|
67
|
-
|
|
68
|
-
const filteredItems = computed(() =>
|
|
69
|
-
filterListItems(items.value, query.value, activeStatus.value),
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
const hasEmpty = computed(() => !loading.value && filteredItems.value.length === 0)
|
|
73
|
-
|
|
74
|
-
function reload() {
|
|
75
|
-
loading.value = true
|
|
76
|
-
setTimeout(() => {
|
|
77
|
-
loading.value = false
|
|
78
|
-
showToast('列表已刷新')
|
|
79
|
-
}, 600)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function onAction(item: (typeof items.value)[number]) {
|
|
83
|
-
showToast(`打开「${item.title}」详情`)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
usePullDownRefresh(reload)
|
|
87
|
-
|
|
88
|
-
reload()
|
|
89
|
-
</script>
|
|
90
|
-
|
|
91
|
-
<template>
|
|
92
|
-
<view class="min-h-screen bg-[#f6f7fb] px-[28rpx] pb-[88rpx] pt-[24rpx] text-[#1c1c3c]">
|
|
93
|
-
<view class="rounded-[28rpx] bg-linear-to-br from-[#fdf2f8] via-[#fff7fb] to-[#ffffff] p-[20rpx]">
|
|
94
|
-
<SectionTitle title="任务清单" subtitle="筛选、搜索与分页反馈" />
|
|
95
|
-
<view class="mt-[12rpx]">
|
|
96
|
-
<FilterBar v-model:query="query" v-model:active="activeStatus" :filters="statusFilters" />
|
|
97
|
-
</view>
|
|
98
|
-
</view>
|
|
99
|
-
|
|
100
|
-
<view v-if="loading" class="mt-[20rpx] flex flex-col items-center gap-[12rpx] rounded-[24rpx] bg-white p-[24rpx]">
|
|
101
|
-
<t-loading theme="circular" size="40" />
|
|
102
|
-
<text class="text-[22rpx] text-[#6f6b8a]">
|
|
103
|
-
正在同步数据...
|
|
104
|
-
</text>
|
|
105
|
-
</view>
|
|
106
|
-
|
|
107
|
-
<view v-else class="mt-[20rpx] space-y-[14rpx]">
|
|
108
|
-
<view v-for="item in filteredItems" :key="item.id" class="rounded-[20rpx] bg-white p-[18rpx] shadow-[0_12rpx_28rpx_rgba(17,24,39,0.08)]">
|
|
109
|
-
<view class="flex items-start justify-between">
|
|
110
|
-
<view>
|
|
111
|
-
<text class="text-[26rpx] font-semibold text-[#1f1a3f]">
|
|
112
|
-
{{ item.title }}
|
|
113
|
-
</text>
|
|
114
|
-
<text class="mt-[6rpx] block text-[22rpx] text-[#6f6b8a]">
|
|
115
|
-
负责人:{{ item.owner }} · 截止 {{ item.deadline }}
|
|
116
|
-
</text>
|
|
117
|
-
</view>
|
|
118
|
-
<t-tag
|
|
119
|
-
size="small"
|
|
120
|
-
:theme="item.status === 'done' ? 'success' : item.status === 'processing' ? 'primary' : 'warning'"
|
|
121
|
-
variant="light"
|
|
122
|
-
>
|
|
123
|
-
{{ item.status === 'done' ? '已完成' : item.status === 'processing' ? '进行中' : '待启动' }}
|
|
124
|
-
</t-tag>
|
|
125
|
-
</view>
|
|
126
|
-
<view class="mt-[12rpx] flex items-center justify-between">
|
|
127
|
-
<view class="flex items-center gap-[8rpx]">
|
|
128
|
-
<t-tag size="small" theme="primary" variant="outline">
|
|
129
|
-
{{ item.priority }}
|
|
130
|
-
</t-tag>
|
|
131
|
-
<text class="text-[20rpx] text-[#7a7aa0]">
|
|
132
|
-
进度跟进
|
|
133
|
-
</text>
|
|
134
|
-
</view>
|
|
135
|
-
<t-button size="small" theme="primary" variant="outline" @tap="onAction(item)">
|
|
136
|
-
查看
|
|
137
|
-
</t-button>
|
|
138
|
-
</view>
|
|
139
|
-
</view>
|
|
140
|
-
</view>
|
|
141
|
-
|
|
142
|
-
<view v-if="hasEmpty" class="mt-[20rpx]">
|
|
143
|
-
<EmptyState title="暂无匹配任务" description="调整筛选条件或刷新数据" action-text="重新加载" @action="reload" />
|
|
144
|
-
</view>
|
|
145
|
-
</view>
|
|
146
|
-
</template>
|
|
@@ -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>
|