axios
This commit is contained in:
parent
f628b0cc0f
commit
fefc78a7ec
11
package-lock.json
generated
11
package-lock.json
generated
@ -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",
|
||||
|
@ -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",
|
||||
|
23
src/main.js
23
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
|
||||
|
||||
|
74
src/pages/login.vue
Normal file
74
src/pages/login.vue
Normal file
@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form :inline="true" :model="formInline" class="demo-form-inline">
|
||||
<el-form-item label="审批人">
|
||||
<el-input
|
||||
v-model="formInline.user"
|
||||
placeholder="审批人"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="活动区域">
|
||||
<el-input
|
||||
v-model="formInline.pwd"
|
||||
placeholder="审批人"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmit">登录</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
formInline:{
|
||||
user:"",
|
||||
pwd:""
|
||||
}
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
onSubmit(){
|
||||
console.log(this.formInline)
|
||||
// jquery data
|
||||
// params url
|
||||
// data 请求体传参
|
||||
// promise
|
||||
// this.axios({
|
||||
// url:"https://tomcat.theluyuan.com/vegetables/user/login",
|
||||
// method:"post",
|
||||
// params:{
|
||||
// phone:this.formInline.user,
|
||||
// password: this.formInline.pwd
|
||||
// }
|
||||
// }).then((res)=>{
|
||||
// console.log(res.data)
|
||||
// })
|
||||
// this.axios.post("https://tomcat.theluyuan.com/vegetables/user/login",{
|
||||
// phone:this.formInline.user,
|
||||
// password: this.formInline.pwd
|
||||
// },{
|
||||
// params:{
|
||||
// asdaL:111111
|
||||
// }
|
||||
// }).then((res)=>{
|
||||
// console.log(res.data)
|
||||
// })
|
||||
this.axios.get("https://tomcat.theluyuan.com/vegetables/user/login",{
|
||||
params:{
|
||||
adasd:213,
|
||||
dasd:111
|
||||
}
|
||||
}).then((res)=>{
|
||||
console.log(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user