vue
乖乖的谋谋
这个作者很懒,什么都没留下…
展开
-
vue路由守卫
1、在返回结果.then(res => { })中写入下面代码,将token存入session window.sessionStorage.setItem('token',res.data.data) 2、在router文件下的index.js写入 router.beforeEach((to,from,next)=>{ //to: Route: 即将要进入的目标 路由对象 //from: Route: 当前导航正要离开的路由 //ne原创 2022-04-08 10:44:09 · 720 阅读 · 0 评论 -
vue调用后端接口
1、在config文件下的index.js文件的proxyTable:{ }中写入 '/api': { target: 'http://localhost:8088/',//此处可以换成自己需要的地址 changeOrigin: true, pathRewrite: { '^/api': '/' } } 2、在main.js中写入 Vue.prototype.HOST = "/api" 3原创 2022-04-08 10:33:33 · 17068 阅读 · 4 评论