From fefc78a7ec6b3f75a28c96e2d9340f80bb5f104b Mon Sep 17 00:00:00 2001 From: theluyuan <1162963624@qq.com> Date: Mon, 30 Aug 2021 09:14:45 +0800 Subject: [PATCH] axios --- package-lock.json | 11 +++++-- package.json | 1 + src/main.js | 23 +++----------- src/pages/login.vue | 74 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 89 insertions(+), 20 deletions(-) create mode 100644 src/pages/login.vue diff --git a/package-lock.json b/package-lock.json index 4c03c63..c48cc89 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2361,6 +2361,14 @@ "integrity": "sha1-1h9G2DslGSUOJ4Ta9bCUeai0HFk=", "dev": true }, + "axios": { + "version": "0.21.1", + "resolved": "https://registry.npm.taobao.org/axios/download/axios-0.21.1.tgz", + "integrity": "sha1-IlY0gZYvTWvemnbVFu8OXTwJsrg=", + "requires": { + "follow-redirects": "^1.10.0" + } + }, "babel-eslint": { "version": "10.1.0", "resolved": "https://registry.npm.taobao.org/babel-eslint/download/babel-eslint-10.1.0.tgz?cache=0&sync_timestamp=1611946213770&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbabel-eslint%2Fdownload%2Fbabel-eslint-10.1.0.tgz", @@ -5450,8 +5458,7 @@ "follow-redirects": { "version": "1.14.2", "resolved": "https://registry.nlark.com/follow-redirects/download/follow-redirects-1.14.2.tgz?cache=0&sync_timestamp=1629288519293&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffollow-redirects%2Fdownload%2Ffollow-redirects-1.14.2.tgz", - "integrity": "sha1-zsuCUEfAD15msUL5D+1PUV3seJs=", - "dev": true + "integrity": "sha1-zsuCUEfAD15msUL5D+1PUV3seJs=" }, "for-in": { "version": "1.0.2", diff --git a/package.json b/package.json index bb601b5..f3478ec 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "lint": "vue-cli-service lint" }, "dependencies": { + "axios": "^0.21.1", "core-js": "^3.6.5", "element-ui": "^2.15.5", "vue": "^2.6.11", diff --git a/src/main.js b/src/main.js index 6a4fb37..46f42a0 100644 --- a/src/main.js +++ b/src/main.js @@ -5,8 +5,9 @@ import index from "./pages/index.vue" import list from "./pages/list.vue" import ElementUI from 'element-ui'; import 'element-ui/lib/theme-chalk/index.css'; +import axios from "axios" Vue.use(ElementUI); - +Vue.prototype.axios = axios // vue 使用这个插件 Vue.use(VueRouter) @@ -25,29 +26,15 @@ const router = new VueRouter({ path:"/list", name:"list", component:list + },{ + path:"/login", + component: ()=> import("./pages/login.vue") },{ path:"*", component: ()=> import("./pages/404.vue") }] }) -// router.beforeEach((diyige,dige,dsf)=>{ -// // to 到哪个 路由 ==》 即将到的那个页面你的this.$route -// // from 来自那个 路由 ==》 跳转的页面的 this.$route -// console.log(to,from) -// if(to.path == "/index/list"){ -// // 不谢任何参数 放行 -// next() -// }else if (to.fullPath == "/list/table"){ -// // false 不跳转 -// next(false) -// }else { -// // 写路径的 跳转到对应 -// // push - -// next({path:"/index/list",query:{aa:11}}) -// } -// }) Vue.config.productionTip = false diff --git a/src/pages/login.vue b/src/pages/login.vue new file mode 100644 index 0000000..395bc36 --- /dev/null +++ b/src/pages/login.vue @@ -0,0 +1,74 @@ + + + + + + + + + + + 登录 + + + + + + + + \ No newline at end of file