vue挂载全局方法和过滤器 ,自定义指令

main.js文件里
过滤器

import commonFilter from './assets/js/filter/commonFilter'; // 公共filter
Object.keys(commonFilter).forEach(key => Vue.filter(key, commonFilter[key]));

自定义指令

import commonDirective from './assets/js/directive/commonDirective'; // 公共指令
Object.keys(commonDirective).forEach(key => Vue.directive(key, commonDirective[key]));

全局方法

import portService from './assets/js/service/http/http'; // http请求
Vue.prototype.portService = portService;
hxy

hxy

秦 夏

留下你的评论

快留下你的小秘密吧