vue-bulma-table
Version:
Vue DataTable with Bulma style
68 lines (57 loc) • 1.33 kB
Markdown
Vue DataTable with Bulma style
```
npm install vue-bulma-table --save
```
or
```
yarn add vue-bulma-table
```
```js
import DataTable from 'vue-bulma-table'
Vue.component('data-table', DataTable)
```
```html
<data-table
:data="data"
:fields="fields"
>
<template slot="lastname" slot-scope="prop">
<h1>{{ prop.data.lastname }}</h1>
</template>
<template slot="footer">
<tr></tr>
</template>
</data-table>
```
```js
export default {
data () {
return {
fields: [
{
name: 'firstname', // name of object property in array
label: 'First name', // optional - custom table header
},
{
name: 'lastname',
label: 'Last name'
},
{
name: 'age',
label: 'Age',
callback: data => { // optional - get data of the role and return to cell
return data.age * 2
}
}
]
}
}
}
```