import { importAll } from '@/utils/utils' const context = require.context('../directives', true, /\.js$/) const directives = importAll(context) export function initDirectives(app) { //全局自定义指令 for (const key in directives) { if (Object.hasOwnProperty.call(directives, key)) { app.directive(key, directives[key].default) } } }