wui-components-v2 1.0.19 → 1.0.21
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/components/menus/menus.vue +16 -10
- package/composables/useTabbar.ts +2 -0
- package/index.ts +0 -2
- package/package.json +1 -1
- package/router/index.ts +0 -79
|
@@ -16,7 +16,7 @@ const props = defineProps({
|
|
|
16
16
|
},
|
|
17
17
|
load: {
|
|
18
18
|
type: Function as PropType<() => void>,
|
|
19
|
-
default: () => {},
|
|
19
|
+
default: () => { },
|
|
20
20
|
},
|
|
21
21
|
})
|
|
22
22
|
// const router = useRouter()
|
|
@@ -161,20 +161,26 @@ function queryList() {
|
|
|
161
161
|
<template #top>
|
|
162
162
|
<slot name="top" />
|
|
163
163
|
</template>
|
|
164
|
-
<
|
|
165
|
-
<
|
|
166
|
-
<
|
|
167
|
-
<wd-grid
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
164
|
+
<view>
|
|
165
|
+
<demoBlock v-for="(item, index) in filtermenu" :key="index" :title="item.title" transparent>
|
|
166
|
+
<view class="border-rd-2 bg-white pa-1 dark:bg-[var(--wot-dark-background2)]">
|
|
167
|
+
<wd-grid :column="4" clickable>
|
|
168
|
+
<wd-grid-item
|
|
169
|
+
v-for="(subItem, subIndex) in item.items" :key="subIndex" icon="picture" :text="subItem.title"
|
|
170
|
+
@itemclick="gotoPage(subItem)"
|
|
171
|
+
/>
|
|
172
|
+
</wd-grid>
|
|
173
|
+
</view>
|
|
174
|
+
</demoBlock>
|
|
175
|
+
<slot name="listBottom" />
|
|
176
|
+
</view>
|
|
177
|
+
|
|
171
178
|
<template #bottom>
|
|
172
179
|
<slot name="bottom" />
|
|
173
180
|
</template>
|
|
174
181
|
</z-paging>
|
|
175
182
|
<wd-action-sheet
|
|
176
|
-
v-model="sheetShow"
|
|
177
|
-
:z-index="9999" :actions="actions" :title="title"
|
|
183
|
+
v-model="sheetShow" :z-index="9999" :actions="actions" :title="title"
|
|
178
184
|
@select="({ item }) => { sheetGotoPage(item) }"
|
|
179
185
|
/>
|
|
180
186
|
</template>
|
package/composables/useTabbar.ts
CHANGED
package/index.ts
CHANGED
|
@@ -13,7 +13,6 @@ import { useGlobalToast } from './composables/useGlobalToast'
|
|
|
13
13
|
import { useUser } from './composables/useUser'
|
|
14
14
|
import { req } from './api/index'
|
|
15
15
|
import { useTabbar } from './composables/useTabbar'
|
|
16
|
-
import router from './router'
|
|
17
16
|
import { persistPlugin } from './store/persist'
|
|
18
17
|
// 组件列表
|
|
19
18
|
const coms: Array<{ name: string }> = [
|
|
@@ -47,7 +46,6 @@ export {
|
|
|
47
46
|
useGlobalMessage,
|
|
48
47
|
useGlobalToast,
|
|
49
48
|
useUser,
|
|
50
|
-
router,
|
|
51
49
|
persistPlugin,
|
|
52
50
|
}
|
|
53
51
|
|
package/package.json
CHANGED
package/router/index.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/// <reference types="@uni-helper/vite-plugin-uni-pages/client" />
|
|
2
|
-
import { pages, subPackages } from 'virtual:uni-pages'
|
|
3
|
-
|
|
4
|
-
function generateRoutes() {
|
|
5
|
-
const routes = pages.map((page) => {
|
|
6
|
-
const newPath = `/${page.path}`
|
|
7
|
-
return { ...page, path: newPath }
|
|
8
|
-
})
|
|
9
|
-
if (subPackages && subPackages.length > 0) {
|
|
10
|
-
subPackages.forEach((subPackage) => {
|
|
11
|
-
const subRoutes = subPackage.pages.map((page: any) => {
|
|
12
|
-
const newPath = `/${subPackage.root}/${page.path}`
|
|
13
|
-
return { ...page, path: newPath }
|
|
14
|
-
})
|
|
15
|
-
routes.push(...subRoutes)
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
return routes
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const router = createRouter({
|
|
22
|
-
routes: generateRoutes(),
|
|
23
|
-
})
|
|
24
|
-
router.beforeEach((to, from, next) => {
|
|
25
|
-
console.log('🚀 beforeEach 守卫触发:', { to, from })
|
|
26
|
-
|
|
27
|
-
// 演示:基本的导航日志记录
|
|
28
|
-
if (to.path && from.path) {
|
|
29
|
-
console.log(`📍 导航: ${from.path} → ${to.path}`)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// 演示:对受保护页面的简单拦截
|
|
33
|
-
if (to.name === 'demo-protected') {
|
|
34
|
-
const { confirm: showConfirm } = useGlobalMessage()
|
|
35
|
-
console.log('🛡️ 检测到访问受保护页面')
|
|
36
|
-
|
|
37
|
-
return new Promise<void>((resolve, reject) => {
|
|
38
|
-
showConfirm({
|
|
39
|
-
title: '守卫拦截演示',
|
|
40
|
-
msg: '这是一个受保护的页面,需要确认后才能访问',
|
|
41
|
-
confirmButtonText: '允许访问',
|
|
42
|
-
cancelButtonText: '取消',
|
|
43
|
-
success() {
|
|
44
|
-
console.log('✅ 用户确认访问,允许导航')
|
|
45
|
-
next()
|
|
46
|
-
resolve()
|
|
47
|
-
},
|
|
48
|
-
fail() {
|
|
49
|
-
console.log('❌ 用户取消访问,阻止导航')
|
|
50
|
-
next(false)
|
|
51
|
-
reject(new Error('用户取消访问'))
|
|
52
|
-
},
|
|
53
|
-
})
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// 继续导航
|
|
58
|
-
next()
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
router.afterEach((to, from) => {
|
|
62
|
-
console.log('🎯 afterEach 钩子触发:', { to, from })
|
|
63
|
-
|
|
64
|
-
// 演示:简单的页面切换记录
|
|
65
|
-
if (to.path) {
|
|
66
|
-
console.log(`📄 页面切换完成: ${to.path}`)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// 演示:针对 afterEach 演示页面的简单提示
|
|
70
|
-
if (to.name === 'demo-aftereach') {
|
|
71
|
-
const { show: showToast } = useGlobalToast()
|
|
72
|
-
console.log('📊 进入 afterEach 演示页面')
|
|
73
|
-
setTimeout(() => {
|
|
74
|
-
showToast('afterEach 钩子已触发!')
|
|
75
|
-
}, 500)
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
export default router
|