这是基于vue-vben-admin 模板适用于abp Vnext的前端管理项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
631 B

import type { App, Directive, DirectiveBinding } from 'vue';
import { useFeatures } from '/@/hooks/abp/useFeatures';
function isFeature(el: Element, binding: any) {
const { featureChecker } = useFeatures();
const value = binding.value;
if (!value) return;
if (!featureChecker.isEnabled(value)) {
el.parentNode?.removeChild(el);
}
}
const mounted = (el: Element, binding: DirectiveBinding<any>) => {
isFeature(el, binding);
};
const featureDirective: Directive = {
mounted,
};
export function setupFeatureDirective(app: App) {
app.directive('feature', featureDirective);
}
export default featureDirective;