菜单管理新增重定向字段

This commit is contained in:
ktianc 2022-10-12 20:58:11 +08:00
parent 9514cef273
commit 5ef581696e
7 changed files with 16 additions and 22 deletions

View File

@ -1,12 +1,4 @@
<div align="center"> <a href="https://github.com/kailong321200875/vue-element-plus-admin"> <img width="100" src="./public/logo.png"> </a> <br> <br> # vue-element-plus-admin
[![license](https://img.shields.io/github/license/kailong321200875/vue-element-plus-admin.svg)](LICENSE)
<h1>vue-element-plus-admin</h1>
</div>
[English](./README.md) | **中文**
## 介绍
vue-element-plus-admin 是一个基于 `element-plus` 免费开源的中后台模版。使用了最新的`vue3``vite3``TypeScript`等主流技术开发,开箱即用的中后台前端解决方案,可以用来作为项目的启动模版,也可用于学习参考。并且时刻关注着最新技术动向,尽可能的第一时间更新。 vue-element-plus-admin 是一个基于 `element-plus` 免费开源的中后台模版。使用了最新的`vue3``vite3``TypeScript`等主流技术开发,开箱即用的中后台前端解决方案,可以用来作为项目的启动模版,也可用于学习参考。并且时刻关注着最新技术动向,尽可能的第一时间更新。

View File

@ -1,14 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { Error } from '@/components/Error' import { Error } from '@/components/Error'
import { usePermissionStore } from '@/store/modules/permission'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
const { push } = useRouter() const { push } = useRouter()
const permissionStore = usePermissionStore()
const errorClick = () => { const errorClick = () => {
push(permissionStore.addRouters[0]?.path as string) push('/')
} }
</script> </script>

View File

@ -1,14 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { Error } from '@/components/Error' import { Error } from '@/components/Error'
import { usePermissionStore } from '@/store/modules/permission'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
const { push } = useRouter() const { push } = useRouter()
const permissionStore = usePermissionStore()
const errorClick = () => { const errorClick = () => {
push(permissionStore.addRouters[0]?.path as string) push('/')
} }
</script> </script>

View File

@ -1,14 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { Error } from '@/components/Error' import { Error } from '@/components/Error'
import { usePermissionStore } from '@/store/modules/permission'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
const { push } = useRouter() const { push } = useRouter()
const permissionStore = usePermissionStore()
const errorClick = () => { const errorClick = () => {
push(permissionStore.addRouters[0]?.path as string) push('/')
} }
</script> </script>

View File

@ -152,6 +152,7 @@ const getMenu = async () => {
addRoute(route as RouteRecordRaw) // 访 addRoute(route as RouteRecordRaw) // 访
}) })
permissionStore.setIsAddRouters(true) permissionStore.setIsAddRouters(true)
console.log(redirect.value || permissionStore.addRouters[0].path)
push({ path: redirect.value || permissionStore.addRouters[0].path }) push({ path: redirect.value || permissionStore.addRouters[0].path })
} }
} }

View File

@ -137,6 +137,15 @@ export const schema = reactive<FormSchema[]>([
}, },
ifshow: (values) => values.menu_type !== '2' ifshow: (values) => values.menu_type !== '2'
}, },
{
field: 'redirect',
label: '重定向',
component: 'Input',
colProps: {
span: 12
},
ifshow: (values) => values.menu_type !== '2'
},
{ {
field: 'hidden', field: 'hidden',
label: '显示状态', label: '显示状态',
@ -192,7 +201,7 @@ export const schema = reactive<FormSchema[]>([
label: '权限标识', label: '权限标识',
component: 'Input', component: 'Input',
colProps: { colProps: {
span: 24 span: 12
}, },
ifshow: (values) => values.menu_type !== '0' ifshow: (values) => values.menu_type !== '0'
} }

View File

@ -18,6 +18,7 @@ class Menu(BaseModel):
title: str title: str
icon: Optional[str] = None icon: Optional[str] = None
component: Optional[str] = None component: Optional[str] = None
redirect: Optional[str] = None
path: Optional[str] = None path: Optional[str] = None
disabled: bool = False disabled: bool = False
hidden: bool = False hidden: bool = False