-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathApp.vue
122 lines (115 loc) · 3.1 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
<template>
<div>
<DxTabPanel
id="tabPanel"
:loop="true"
:animation-enabled="true"
:swipe-enabled="true"
v-model:selected-index="selectedTabIndex">
<DxItem title="Employee" icon="floppy">
<template #default>
<DxForm
id="form"
:form-data="employeeData">
<DxSimpleItem data-field="name">
<DxLabel template="nameLabel"/>
</DxSimpleItem>
<DxSimpleItem data-field="position">
<DxLabel template="positionLabel"/>
</DxSimpleItem>
<DxSimpleItem data-field="hireDate" />
<DxSimpleItem data-field="officeNumber">
<DxLabel template="officeNumberLabel"/>
</DxSimpleItem>
<template #nameLabel="{ data }">
<i class="dx-icon dx-icon-user"/>{{ data.text }}
</template>
<template #positionLabel="{ data }">
<i class="dx-icon dx-icon-group"/>{{ data.text }}
</template>
<template #officeNumberLabel="{ data }">
<i class="dx-icon dx-icon-info"/>{{ data.text }}
</template>
</DxForm>
</template>
</DxItem>
<DxItem title="Notes" icon="comment">
<template #default>
<DxTextArea
id="textArea"
v-model:value="employeeData.notes"
/>
</template>
</DxItem>
<DxItem title="Role" icon="isnotblank" badge="new">
<template #default>
<DxRadioGroup
id="radioGroup"
:items="employeeData.roles"
v-model:value="employeeData.roles[0]"
/>
</template>
</DxItem>
</DxTabPanel>
<DxRadioGroup
:items="tabNames"
:value="tabNames[selectedTabIndex]"
layout="horizontal"
@value-changed="onValueChanged"
/>
</div>
</template>
<script>
import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';
import DxTabPanel, { DxItem } from "devextreme-vue/tab-panel";
import DxForm, { DxSimpleItem, DxLabel } from "devextreme-vue/form";
import DxTextArea from "devextreme-vue/text-area";
import DxRadioGroup from "devextreme-vue/radio-group";
export default {
components: {
DxTabPanel,
DxItem,
DxForm,
DxSimpleItem,
DxLabel,
DxTextArea,
DxRadioGroup
},
data() {
const employeeData = {
name: 'John Heart',
position: 'CEO',
hireDate: new Date(2012, 4, 13),
officeNumber: 901,
notes: 'John has been in the Audio/Video industry since 1990. He has led DevAV as its CEO since 2003.',
roles: ['Chief Officer', 'Administrator', 'Manager']
};
const tabNames = ['Employee', 'Notes', 'Role'];
return {
employeeData,
selectedTabIndex: 0,
tabNames
};
},
methods: {
onValueChanged(e){
this.selectedTabIndex = this.tabNames.indexOf(e.value);
}
}
};
</script>
<style>
#tabPanel {
height: 250px;
width: 500px;
border: 1px solid;
}
#form, #radioGroup {
padding: 15px;
}
#textArea {
padding: 15px;
height: 100%;
}
</style>