陈文彬
2020-09-28 2f6253cfb601c0a429ade1a272f5812a55d363af
提交 | 用户 | age
2f6253 1 <template>
2   <div class="p-10 m-4 rounded-md bg-white">
3     <Alert
4       message="目前mock了两组数据, id为1 和 2 具体返回的菜单可以在mock/sys/menu.ts内查看"
5       show-icon
6     />
7     <CurrentPermissionMode />
8
9     <Alert class="mt-4" type="info" message="点击后请查看左侧菜单变化" show-icon />
10
11     <div class="mt-4">
12       权限切换(请先切换权限模式为后台权限模式):
13       <a-button-group>
14         <a-button @click="changeMenu('1')"> 获取用户id为1的菜单 </a-button>
15         <a-button @click="changeMenu('2')"> 获取用户id为2的菜单 </a-button>
16       </a-button-group>
17     </div>
18   </div>
19 </template>
20 <script lang="ts">
21   import { defineComponent } from 'vue';
22   import { Alert } from 'ant-design-vue';
23   import CurrentPermissionMode from '../CurrentPermissionMode.vue';
24   import { RoleEnum } from '/@/enums/roleEnum';
25   import { usePermission } from '/@/hooks/web/usePermission';
26
27   export default defineComponent({
28     components: { Alert, CurrentPermissionMode },
29     setup() {
30       const { changeMenu } = usePermission();
31       return {
32         RoleEnum,
33         changeMenu,
34       };
35     },
36   });
37 </script>