Vue.prototype.$axios = axios
axios.interceptors.request.use(
config => {
if (config.haveNoRight) {
return Promise.reject({
haveNoRight: true
})
}
}
)
import AccessControl from 'access_control_vue'
const isProduction = process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'test'
AccessControl.syncLimit({
axios: this.$axios,
asyncInterface: '异步接口1,异步接口2...',
switchOn: isProduction
})
this.$router.beforeEach(
AccessControl.routerGuard({
syncInterface: '可访问路由1,可访问路由2...',
certainPath: '/certainPath/',
switchOn: isProduction,
defaultPage: '/welcomePage'
})
)