wms-antdvue/.svn/pristine/2a/2a32aad84ef2c14dcc835a4f799c44199da012eb.svn-base
2024-11-07 16:33:03 +08:00

34 lines
793 B
Plaintext

<script lang="ts">
import type { PropType } from 'vue';
import { defineComponent } from 'vue';
import { usePermission } from '@/hooks/web/usePermission';
import { getSlot } from '@/utils/helper/tsxHelper';
export default defineComponent({
name: 'AuthorityPage',
props: {
value: {
type: Array as PropType<string[]>,
default: () => [],
},
},
setup(props, { slots }) {
const { hasPermission } = usePermission();
/**
* Render button
*/
function renderAuth() {
const { value } = props;
if (!value) {
return getSlot(slots);
}
return hasPermission(value) ? getSlot(slots) : null;
}
return () => {
return renderAuth();
};
},
});
</script>