视图切换时无法被正常渲染 #1954
Unanswered
bobolike123
asked this question in
Q&A
视图切换时无法被正常渲染
#1954
Replies: 2 comments 2 replies
-
亲故,你的问题解决了么? 我也出现类似的问题了,但我的1-1正常,1-2不行,再切回1-1就不行了。 |
Beta Was this translation helpful? Give feedback.
1 reply
-
雖然是非常久以前的問題,不過最近我也遇到這個問題,本來還以為是改成使用後端產生Menu導致的,但結果卻不是。 我發生這個問題的根源是因為在 這個標籤中含有一些註解掉的其他標籤,例如: <script setup lang="ts">
import { useAccess } from "@vben/access";
import { Button } from "ant-design-vue";
const { hasAccessByRoles } = useAccess();
</script>
<template>
<div class="flex flex-col gap-4">
<h2>Source management</h2>
<div class="flex flex-row gap-2">
<Button v-if="hasAccessByRoles(['super'])" type="primary">
Super User Only
</Button>
<Button v-if="hasAccessByRoles(['admin'])" type="dashed">
Admin User Only
</Button>
<Button v-if="hasAccessByRoles(['user'])" type="ghost">
Normal User Only
</Button>
<!-- <Button v-if="hasAccessByRoles(['admin', 'super'])" type="dashed">
Admin & Super User Only
</Button>
<Button v-if="hasAccessByRoles(['admin', 'user'])" type="dashed">
Admin & Normal User Only
</Button>
<Button type="default">All</Button> -->
</div>
</div>
</template> 在這種情況下就會發生樓主描述的情況: 菜单上能正确出现注册的视图,但是浏览器初次刷新时组件能刷出来,同一级子菜单切换了多次以后视图渲染不出来了 由於任何錯誤的訊息都沒有,所以其實花了挺久才找到問題的根源。 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
=====菜单示例======
一级菜单1
子菜单1-1
子菜单1-2
子菜单1-3
=====菜单示例END======
版本:vben-admin-thin-next @2.8.0
问题:视图切换时无法被正常渲染
问题说明:我在路由的module下注册了路由信息,菜单上能正确出现注册的视图,但是浏览器初次刷新时组件能刷出来,同一级子菜单切换了多次以后视图渲染不出来了。如我刷新浏览器,目前是子菜单1-1的视图,当我点击1-2能显示,但是点击1-3就一片空白没有渲染。同理,刷新浏览器是1-3,点击1-2能显示,再点1-1就不能渲染出来了。控制台无报错(Edge浏览器)。我这边录了视频演示但是不知道怎么上传。
Beta Was this translation helpful? Give feedback.
All reactions