@xizs/nuxt-antui 0.0.37 → 0.0.39

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.
@@ -68,6 +68,13 @@ const items = computed(()=>{
68
68
 
69
69
  let routeInfo = useRouteInfo(props.items)
70
70
 
71
+ watch(routeInfo, (newVal, oldVal) => {
72
+ if (newVal && newVal.paths) {
73
+ state.selectedKeys = newVal.paths
74
+ state.openKeys = newVal.paths
75
+ }
76
+ })
77
+
71
78
  onMounted(()=>{
72
79
  state.selectedKeys=routeInfo?.value?.paths
73
80
  state.openKeys=routeInfo?.value?.paths
@@ -9,6 +9,7 @@ export const useRouteInfo = (menuItems: any[]) =>
9
9
  console.log(menuItems)
10
10
 
11
11
  const route = useRoute()
12
+ console.log(route)
12
13
 
13
14
  const findPath = (
14
15
  items: any[],
@@ -34,7 +35,11 @@ export const useRouteInfo = (menuItems: any[]) =>
34
35
  watch(
35
36
  () => route.fullPath,
36
37
  () => {
37
- const match = findPath(menuItems, route.path)
38
+ let path = route.path
39
+ if (path.endsWith('/')) {
40
+ path = path.slice(0, -1)
41
+ }
42
+ const match = findPath(menuItems, path)
38
43
  if (match) {
39
44
  info.value = {
40
45
  name: match.titles.at(-1) || '',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xizs/nuxt-antui",
3
3
  "type": "module",
4
- "version": "0.0.37",
4
+ "version": "0.0.39",
5
5
  "main": "./nuxt.config.ts",
6
6
  "scripts": {
7
7
  "dev": "nuxi dev .playground",