mirror of
https://gitee.com/likeadmin/likeadmin_java.git
synced 2026-06-20 17:16:09 +08:00
部分修改
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
v-else
|
||||
:to="{
|
||||
path: path,
|
||||
query: resolveQuery
|
||||
query: resolveQuery,
|
||||
}"
|
||||
>
|
||||
<el-menu-item :index="path">
|
||||
@@ -30,55 +30,55 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { queryToObject } from '@/utils/util'
|
||||
import { isQuery } from '@/utils/validate'
|
||||
import { computed, defineComponent, toRefs } from 'vue'
|
||||
import { RouteRecordRaw } from 'vue-router'
|
||||
export default defineComponent({
|
||||
components: {},
|
||||
props: {
|
||||
route: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
import { queryToObject } from '@/utils/util'
|
||||
import { isQuery } from '@/utils/validate'
|
||||
import { computed, defineComponent, toRefs } from 'vue'
|
||||
import { RouteRecordRaw } from 'vue-router'
|
||||
export default defineComponent({
|
||||
components: {},
|
||||
props: {
|
||||
route: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
path: {
|
||||
type: String,
|
||||
},
|
||||
},
|
||||
path: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
setup(props) {
|
||||
const { path, route } = toRefs(props)
|
||||
// 是否有子路由
|
||||
const hasChildren = computed(() => {
|
||||
const children: RouteRecordRaw[] = route.value.children ?? []
|
||||
return !!children.filter(item => !item.meta?.hidden).length
|
||||
})
|
||||
// 解析路径,后台上传的并非完整路径
|
||||
const resolvePath = computed(() => (p?: string) => {
|
||||
return p !== undefined ? `${path.value}/${p}` : path.value
|
||||
})
|
||||
// 解析参数'{id:1}'|| id=1 => {id: 1}
|
||||
const resolveQuery = computed(() => {
|
||||
const query = route.value.query
|
||||
try {
|
||||
if (isQuery(query)) {
|
||||
return queryToObject(query)
|
||||
} else {
|
||||
return JSON.parse(query)
|
||||
}
|
||||
} catch (error) {}
|
||||
})
|
||||
setup(props) {
|
||||
const { path, route } = toRefs(props)
|
||||
// 是否有子路由
|
||||
const hasChildren = computed(() => {
|
||||
const children: RouteRecordRaw[] = route.value.children ?? []
|
||||
return !!children.filter((item) => !item.meta?.hidden).length
|
||||
})
|
||||
// 解析路径,后台上传的并非完整路径
|
||||
const resolvePath = computed(() => (p?: string) => {
|
||||
return p !== undefined ? `${path.value}/${p}` : path.value
|
||||
})
|
||||
// 解析参数'{id:1}'|| id=1 => {id: 1}
|
||||
const resolveQuery = computed(() => {
|
||||
const query = route.value.query
|
||||
try {
|
||||
if (isQuery(query)) {
|
||||
return queryToObject(query)
|
||||
} else {
|
||||
return JSON.parse(query)
|
||||
}
|
||||
} catch (error) {}
|
||||
})
|
||||
|
||||
return {
|
||||
hasChildren,
|
||||
resolvePath,
|
||||
resolveQuery
|
||||
}
|
||||
}
|
||||
})
|
||||
return {
|
||||
hasChildren,
|
||||
resolvePath,
|
||||
resolveQuery,
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.iconfont {
|
||||
font-size: 26px;
|
||||
}
|
||||
.iconfont {
|
||||
font-size: 18px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user