Files
mayfly-go/frontend/src/components/auth/auth.vue
2024-10-31 17:24:56 +08:00

29 lines
623 B
Vue

<template>
<div v-if="getUserAuthBtnList">
<slot />
</div>
</template>
<script lang="ts">
import { computed } from 'vue';
import { useUserInfo } from '@/store/userInfo';
export default {
name: 'auth',
props: {
value: {
type: String,
default: () => '',
},
},
setup(props) {
// 获取 vuex 中的用户权限
const getUserAuthBtnList = computed(() => {
return useUserInfo().userInfo.authBtnList.some((v: any) => v === props.value);
});
return {
getUserAuthBtnList,
};
},
};
</script>