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.

52 lines
1.4 KiB

3 years ago
import Vue from "vue";
import App from "@/App.vue";
import router from "@/router";
import ElementUI from "element-ui";
import "@/styles/index.scss";
import VueI18n from "vue-i18n";
import mixinApp from "@/mixins/app";
import { messages } from "@/i18n";
import "babel-polyfill";
import "@/libs/resize";
import { post, get, del, put } from "@/plugins/requests/index.js";
import api from "@/api";
import store from "@/store";
import Setting from "@/setting";
4 years ago
// 插件
3 years ago
import plugins from "@/plugins";
import filters from "@/plugins/filters";
4 years ago
Vue.use(plugins);
3 years ago
Object.keys(filters).forEach(item => Vue.filter(item, filters[item]));
3 years ago
4 years ago
Vue.prototype.api = api;
Vue.prototype.$get = get;
Vue.prototype.$post = post;
Vue.prototype.$del = del;
Vue.prototype.$put = put;
Vue.config.productionTip = false;
Vue.use(VueI18n);
3 years ago
Vue.use(ElementUI, { size: "small" });
4 years ago
const i18n = new VueI18n({
3 years ago
locale: Setting.i18n.default,
4 years ago
messages
});
3 years ago
Vue.prototype.auth = function(values){
// 直接拿值进行匹配,取得当前router的mate信息,传入,返回一个boolean,以此进行vif判断
3 years ago
// router.meta 信息匹配传进来的value,用vif去进行按钮级权限配置即可。
// $router.currentRoute.meta
3 years ago
console.log(router.currentRoute.meta,'当前路由的按钮权限数组')
3 years ago
return router.currentRoute.meta.btn.some(e=>e===values)
}
4 years ago
new Vue({
3 years ago
mixins: [mixinApp],
4 years ago
router,
i18n,
3 years ago
store,
4 years ago
render: h => h(App)
3 years ago
}).$mount("#app");