-
Notifications
You must be signed in to change notification settings - Fork 67
lesson 03
Rati Wannapanop edited this page May 24, 2017
·
2 revisions
In the last lesson, we added more fields to be displayed using the fields
prop. In the more complex data structure, there could be a lot more field to display. As you can see the fields
prop could get quite lengthy.
We could make use of the data
section of Vue to make it cleaner, like so.
// MyVuetable.vue
<template>
<vuetable ref="vuetable"
api-url="https://vuetable.ratiw.net/api/users"
:fields="fields"
></vuetable>
</template>
<script>
import Vuetable from 'vuetable-2/src/components/Vuetable'
export default {
components: {
Vuetable
},
data () {
return {
fields: [
'name', 'email', 'birthdate',
'address.line1', 'address.line2', 'address.zipcode'
]
}
}
}
</script>
Run the project again to see that everything is still working the same.
$ yarn run dev
We should also remove the unused file that comes pre-install with vue-cli webpack template.
- Delete
src\components\Hello.vue
- Your first Vuetable
- Displaying more fields
- Cleaning up code
- Make change to field title
- Column alignment
- Format fields using
callback
option - Adding pagination
- Displaying pagination information
- Customizing Vuetable
- Make columns sortable
- Using special fields
- Adding Detail Row
- Adding Search Filter
- Moving Field Definitions to another file
- Passing Props to MyVuetable - Part 1
- Passing Props to MyVuetable - Part 2
- Passing Scoped Slot to MyVuetable
- Using Twitter's Bootstrap CSS with Vuetable
- Pagination for Twitter's Bootstrap