-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
72 lines (71 loc) · 1.84 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>HeyUI</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/heyui/themes/index.css">
</head>
<body>
<div id="app" v-padding="20">
<div v-height="50">
<SwitchList :datas="labels" v-model="labelPosition" :small="true"></SwitchList>
</div>
<h-form ref="form" :label-position="labelPosition" :label-width="90" :rules="validationRules" :model="model">
<h-formitem label="用户名" prop="name">
<input type="text" v-model="model.name" />
</h-formitem>
<h-formitem label="密码" prop="password">
<input type="password" v-model="model.password" />
</h-formitem>
<h-formitem>
<h-button color="primary" :loading="isLoading" @click="submit">提交</h-button>
<h-button @click="reset">取消</h-button>
</h-formitem>
</h-form>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="./dist/heyui.js"></script>
<script>
var app = new Vue({
el: '#app',
data: {
isLoading: false,
labelPosition: "left",
labels: {
left: 'Label左对齐',
right: 'Label右对齐',
},
model: {
name: "",
password: ""
},
validationRules: {
required: [
'name',
'password'
]
}
},
methods: {
submit() {
this.isLoading = true;
let validResult = this.$refs.form.valid();
if (validResult.result) {
this.$Message("验证成功");
setTimeout(() => {
this.isLoading = false;
}, 1000);
} else {
this.isLoading = false;
}
},
reset() {
this.$refs.form.reset();
}
}
})
</script>
</html>