5
5
<button type =" button" class =" btn btn-primary ml-1" @click =" setData1" >Set users 1</button >
6
6
<button type =" button" class =" btn btn-primary ml-1" @click =" setData2" >Set users 2</button >
7
7
<button type =" button" class =" btn btn-primary ml-1" @click =" setDataAll" >Set users all</button >
8
+ <button type =" button" class =" btn btn-primary ml-1" @click =" addOne" >Add one user</button >
9
+ <button type =" button" class =" btn btn-primary ml-1" @click =" removeOne" >Remove one user</button >
8
10
</div >
9
11
<dataset
10
12
v-slot =" { ds }"
13
15
:ds-sortby =" ['name']"
14
16
:ds-search-in =" ['balance', 'birthdate', 'name', 'company', 'email', 'phone', 'address', 'favoriteAnimal']"
15
17
:ds-search-as =" {}"
18
+ @update:ds-data =" updateDsData"
16
19
>
17
20
<div class =" row mb-2" :data-page-count =" ds.dsPagecount" >
18
21
<div class =" col-md-6 mb-2 mb-md-0" >
@@ -66,6 +69,23 @@ const users1 = clone(jsonUsers).slice(0, 12)
66
69
const users2 = clone (jsonUsers).slice (13 , 25 )
67
70
const usersAll = clone (jsonUsers)
68
71
72
+ const user = {
73
+ _id: ' EA265B20-45F2-953C-C534-3E2A78620ins' ,
74
+ isActive: true ,
75
+ onlineStatus: ' Do not disturb' ,
76
+ balance: 10000 ,
77
+ birthdate: ' 1978-12-24' ,
78
+ favoriteColor: ' orredange' ,
79
+ firstName: ' Inserted' ,
80
+ lastName: ' User' ,
81
+ name: ' Inserted User' ,
82
+ company: ' Inserted AG' ,
83
+
84
+ phone: ' (0112) 192 5651' ,
85
+ address: ' P.O. Box 98, 571 Inserted Rd.' ,
86
+ favoriteAnimal: ' cat'
87
+ }
88
+
69
89
export default {
70
90
name: ' Home' ,
71
91
data () {
@@ -89,6 +109,15 @@ export default {
89
109
},
90
110
setDataAll () {
91
111
this .users = usersAll
112
+ },
113
+ updateDsData (data ) {
114
+ console .log (data)
115
+ },
116
+ addOne () {
117
+ this .users .unshift (user)
118
+ },
119
+ removeOne () {
120
+ this .users .splice (0 , 1 )
92
121
}
93
122
}
94
123
}
0 commit comments