refactor(permission.ts): 优化typescript错误提示

This commit is contained in:
有来技术
2021-12-02 00:13:54 +08:00
parent 58d3c0102f
commit a61c2cc68a
2 changed files with 2 additions and 3 deletions

View File

@@ -26,7 +26,7 @@ const hasPermission = (roles: string[], route: RouteRecordRaw) => {
export const filterAsyncRoutes = (routes: RouteRecordRaw[], roles: string[]) => { export const filterAsyncRoutes = (routes: RouteRecordRaw[], roles: string[]) => {
const res: RouteRecordRaw[] = [] const res: RouteRecordRaw[] = []
routes.forEach(route => { routes.forEach(route => {
const tmp = {...route} const tmp = {...route} as any
if (hasPermission(roles, tmp)) { if (hasPermission(roles, tmp)) {
if (tmp.component == 'Layout') { if (tmp.component == 'Layout') {
tmp.component = Layout tmp.component = Layout

View File

@@ -8,8 +8,7 @@ export default defineComponent({
const {path} = params const {path} = params
useRouter().replace({path: '/' + path, query}) useRouter().replace({path: '/' + path, query})
}, },
render(h) { render() {
return h()
} }
}) })
</script> </script>