23 lines
1013 B
TypeScript
Raw Normal View History

2024-07-16 18:49:19 +08:00
import { App } from "vue";
2025-04-10 11:45:46 +08:00
import antiShake from "@/directives/modules/global/anti-shake";
import throttle from "@/directives/modules/global/throttle";
import custom from "@/directives/modules/global/custom";
import hasPerm from "@/directives/modules/permission/has-perm";
2024-07-16 18:49:19 +08:00
2024-07-12 18:30:09 +08:00
// 定义安装函数
// install 函数是一个对象中的方法,其作用是将一系列指令对象安装到 Vue 应用实例中它自带两个参数app 和 options
// app就是vue实例options则是安装函数的参数(可选)
// install 方法的定义就插件对象install 方法会在引入插件时自动被 vue 调用,并传参 vue 实例和 options
const directives = {
2024-07-16 18:49:19 +08:00
install(app: App<Element>) {
2024-07-12 18:30:09 +08:00
// 将一系列自定义指令对象安装到 Vue 应用实例中
2024-07-13 18:47:45 +08:00
app.directive("antiShake", antiShake);
app.directive("throttle", throttle);
app.directive("custom", custom);
2025-04-10 11:45:46 +08:00
app.directive("hasPerm", hasPerm);
2024-07-12 18:30:09 +08:00
}
};
// 导出安装函数
export default directives;