Skip to content

Commit

Permalink
⚡ Impove example
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed May 11, 2016
1 parent 0b1c36f commit 1193b8f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
3 changes: 2 additions & 1 deletion dev/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
import {each, isFunction, cloneDeep, merge} from 'lodash';
Vue.use(VueFormGenerator);
export default {
components: {
"VueFormGenerator": VueFormGenerator.component,
DataTable
},
Expand Down
25 changes: 23 additions & 2 deletions dev/dataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,29 @@
th Name
th E-mail
th Country
th Role
th Status

tbody
tr(v-for="row in rows", @click="select($event, row)", :class="{ active: isSelected(row) }")
td {{ row.id }}
td
img(:src="row.avatar")
| {{ row.name }}
.label.label-warning(v-if="!row.status") Inactive
td {{ row.email }}
td {{ row.address.country }}
td {{ getRoleName(row) }}
td
i.fa(:class=" row.status? 'fa-check' : 'fa-ban' ")
</template>

<script>
import Vue from "vue";
import VueFormGenerator from "../src";
import Schema from "./schema";
import { users } from "./data";
import { find } from "lodash";
import { users, roles } from "./data";
export default {
props: [
Expand All @@ -33,7 +40,12 @@
methods: {
isSelected(row) {
return this.selected.indexOf(row) != -1;
}
},
getRoleName(row) {
let role = find(roles, role => role.id == row.role);
return role ? role.name : "";
}
}
}
</script>
Expand All @@ -44,6 +56,15 @@
.table {
tr {
cursor: pointer;
td {
img {
width: 32px;
height: 32px;
border-radius: 100%;
margin-right: 0.4em;
}
}
}
}
Expand Down

0 comments on commit 1193b8f

Please sign in to comment.