26 lines
789 B
TypeScript
26 lines
789 B
TypeScript
import type { App } from 'vue';
|
|
import addTitleAtEllipsis from './add-title-at-ellipsis';
|
|
import elementExposure from './element-exposure';
|
|
import safeHtml from './safe-html';
|
|
import xssProtect from './xss-protect';
|
|
import { LoadingDirective } from 'vue-devui/loading';
|
|
import { fileDropDirective } from 'vue-devui/upload';
|
|
|
|
// 注册到全局的指令
|
|
const GLOBAL_DIRECTIVES = {
|
|
'add-title-at-ellipsis': addTitleAtEllipsis,
|
|
'element-exposure': elementExposure,
|
|
'safe-html': safeHtml,
|
|
'xss-protect': xssProtect,
|
|
'loading': LoadingDirective,
|
|
'file-drop': fileDropDirective
|
|
} as { [name: string]: object; };
|
|
|
|
export default {
|
|
install(app: App) {
|
|
Object.keys(GLOBAL_DIRECTIVES).forEach((name: string) => {
|
|
app.directive(name, GLOBAL_DIRECTIVES[name]);
|
|
});
|
|
}
|
|
};
|