Skip to content

Commit

Permalink
fix: 修复AccessControl默认codes逻辑错误
Browse files Browse the repository at this point in the history
  • Loading branch information
little-alei committed Dec 22, 2024
1 parent 68a7e79 commit fd74d3b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/effects/access/src/access-control.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { useAccess } from './use-access';
interface Props {
/**
* Specified codes is visible
* @default []
*/
codes?: string[];

Expand All @@ -29,14 +28,14 @@ defineOptions({
});

const props = withDefaults(defineProps<Props>(), {
codes: () => [],
codes: undefined,
type: 'role',
});

const { hasAccessByCodes, hasAccessByRoles } = useAccess();

const hasAuth = computed(() => {
const { codes, type } = props;
const { codes = [], type } = props;
return type === 'role' ? hasAccessByRoles(codes) : hasAccessByCodes(codes);
});
</script>
Expand Down

0 comments on commit fd74d3b

Please sign in to comment.