-
Notifications
You must be signed in to change notification settings - Fork 2
/
App.vue
144 lines (132 loc) · 3.38 KB
/
App.vue
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<template>
<div id="app-container">
<form action="/employee-page" @submit="handleSubmit">
<DxForm
id="form"
:form-data="employee"
:read-only="isFormReadOnly"
label-location="top"
:show-colon-after-label="false">
<DxGroupItem
:col-count="2">
<DxGroupItem caption="Employee">
<DxSimpleItem data-field="name" :is-required="true"/>
<DxSimpleItem data-field="position"/>
<DxSimpleItem data-field="hireDate"/>
<DxSimpleItem data-field="officeNumber">
<DxNumericRule
message="This field should contain a number"
/>
</DxSimpleItem>
</DxGroupItem>
<DxGroupItem caption="Personal Information">
<DxTabbedItem>
<DxTabPanelOptions
:height="260"
/>
<DxTab title="Contacts">
<DxSimpleItem data-field="phone"/>
<DxSimpleItem data-field="skype"/>
<DxSimpleItem data-field="email">
<DxEmailRule
message="This is not a valid Email"
/>
</DxSimpleItem>
</DxTab>
<DxTab title="Note">
<DxSimpleItem
data-field="notes"
editor-type="dxTextArea"
/>
</DxTab>
</DxTabbedItem>
</DxGroupItem>
</DxGroupItem>
<DxButtonItem
horizontal-alignment="center">
<DxButtonOptions
text="Submit the Form"
:use-submit-behavior="true"
/>
</DxButtonItem>
</DxForm>
</form>
<DxCheckBox
id="check-box"
text="Enable read-only mode"
v-model:value="isFormReadOnly"
/>
</div>
</template>
<script>
import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';
import {
DxForm,
DxSimpleItem,
DxGroupItem,
DxButtonItem,
DxButtonOptions,
DxTabbedItem,
DxTab,
DxTabPanelOptions,
DxNumericRule,
DxEmailRule
} from 'devextreme-vue/form';
import { DxCheckBox } from 'devextreme-vue/check-box';
import 'devextreme-vue/text-area';
const employee = {
name: 'John Heart',
position: 'CEO',
hireDate: new Date(2012, 4, 13),
officeNumber: 901,
phone: '+1(213) 555-9392',
skype: 'jheart_DX_skype',
email: 'jheart@dx-email.com',
notes: 'John has been in the Audio/Video industry since 1990.'
};
let isFormReadOnly = false;
export default {
name: "app",
components: {
DxForm,
DxSimpleItem,
DxGroupItem,
DxButtonItem,
DxButtonOptions,
DxTabbedItem,
DxTab,
DxTabPanelOptions,
DxNumericRule,
DxEmailRule,
DxCheckBox
},
data() {
return {
employee,
isFormReadOnly
}
},
methods: {
handleSubmit(e) {
setTimeout(() => {
alert("Submitted");
}, 1000);
e.preventDefault();
}
}
}
</script>
<style scoped>
#form {
padding: 10px;
border: 1px solid;
}
#check-box {
margin-top: 10px;
}
#app-container {
width: 900px;
position: relative;
}
</style>