Skip to content

Commit 1193b8f

Browse files
committed
⚡ Impove example
1 parent 0b1c36f commit 1193b8f

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

dev/app.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@
4040
4141
import {each, isFunction, cloneDeep, merge} from 'lodash';
4242
43+
Vue.use(VueFormGenerator);
44+
4345
export default {
4446
components: {
45-
"VueFormGenerator": VueFormGenerator.component,
4647
DataTable
4748
},
4849

dev/dataTable.vue

+23-2
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,29 @@
66
th Name
77
th E-mail
88
th Country
9+
th Role
10+
th Status
911

1012
tbody
1113
tr(v-for="row in rows", @click="select($event, row)", :class="{ active: isSelected(row) }")
1214
td {{ row.id }}
1315
td
16+
img(:src="row.avatar")
1417
| {{ row.name }}
1518
.label.label-warning(v-if="!row.status") Inactive
1619
td {{ row.email }}
1720
td {{ row.address.country }}
21+
td {{ getRoleName(row) }}
22+
td
23+
i.fa(:class=" row.status? 'fa-check' : 'fa-ban' ")
1824
</template>
1925

2026
<script>
2127
import Vue from "vue";
2228
import VueFormGenerator from "../src";
2329
import Schema from "./schema";
24-
import { users } from "./data";
30+
import { find } from "lodash";
31+
import { users, roles } from "./data";
2532
2633
export default {
2734
props: [
@@ -33,7 +40,12 @@
3340
methods: {
3441
isSelected(row) {
3542
return this.selected.indexOf(row) != -1;
36-
}
43+
},
44+
45+
getRoleName(row) {
46+
let role = find(roles, role => role.id == row.role);
47+
return role ? role.name : "";
48+
}
3749
}
3850
}
3951
</script>
@@ -44,6 +56,15 @@
4456
.table {
4557
tr {
4658
cursor: pointer;
59+
60+
td {
61+
img {
62+
width: 32px;
63+
height: 32px;
64+
border-radius: 100%;
65+
margin-right: 0.4em;
66+
}
67+
}
4768
}
4869
}
4970

0 commit comments

Comments
 (0)