testaxios.vue
2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<template>
<div>
<Row>
<Col span="24">
<div class="content">
<Form ref='data'
:model="data"
:label-width="80"
class="demo-ruleForm card-box loginform">
<h3 class="title">系统登录</h3>
<Form-item label="帐号"
prop="username">
<Input type="text"
v-model="data.username"></Input>
</Form-item>
<Form-item label="密码"
prop="password">
<Input type="password"
v-model="data.password"></Input>
</Form-item>
<Form-item>
<Button type="primary"
@click='login()'>提交</Button>
<Button type="primary"
@click='loginError()'>错误提交</Button>
<Button type="ghost"
style="margin-left: 8px">重置</Button>
</Form-item>
</Form>
</div>
</Col>
</Row>
</div>
</template>
<script>
export default {
name: 'content',
data() {
return {
data: {
username: '',
password: '',
// token: ''
},
}
},
methods: {
login() {
var self = this;
console.log(self.data.username);
this.axios.get("public/act/getAll").then((res) => {
console.log(JSON.stringify(error));
console.log("页面里面:" + res);
})
},
loginError(){
this.axios.get("test/axioserror").then((res) => {
console.log("页面里面:" + res);
}).catch((error)=>{
console.log(error);
})
}
},
created() {
},
mounted() {
}
}
</script>