refactor(navbar): 重构角色切换功能
- 将角色名称改为角色备注显示在按钮上- 动态生成角色选项,提高可维护性 - 优化代码结构,提高可读性和可扩展性
This commit is contained in:
parent
d94cbe2aee
commit
a9e39fd950
@ -153,20 +153,11 @@
|
||||
<li>
|
||||
<!-- <a-button status="normal">{{ userStore.role.name }}</a-button>-->
|
||||
<a-dropdown trigger="click">
|
||||
<a-button status="normal">{{ userStore.role.name }}</a-button>
|
||||
<a-button status="normal">{{ userStore.role.remark }}</a-button>
|
||||
<template #content>
|
||||
<a-doption>
|
||||
<a-space @click="handleSwitchRole(50)">
|
||||
<span>
|
||||
管理员
|
||||
</span>
|
||||
</a-space>
|
||||
</a-doption>
|
||||
<a-doption>
|
||||
<a-space @click="handleSwitchRole(75)">
|
||||
<span>
|
||||
经理
|
||||
</span>
|
||||
<a-doption v-for="role in userStore.roles" :key="role.id">
|
||||
<a-space @click="handleSwitchRole(role.id)">
|
||||
{{ role.remark }}
|
||||
</a-space>
|
||||
</a-doption>
|
||||
</template>
|
||||
|
Loading…
Reference in New Issue
Block a user