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.
shop-pc/plugins/vue-inject.js

18 lines
409 B

import Vue from "vue";
import { TOKEN_KEY } from "@/constants";
const injectOptions = {
// 是否需要登录拦截,如果未登录,会默认唤起登录弹窗
$isLoginValidate() {
if (this.$cookies.get(TOKEN_KEY)) {
return true;
}
this.$store.commit("setLoginVisible", true);
return false;
},
};
for (let key in injectOptions) {
Vue.prototype[key] = injectOptions[key];
}