插件名称 | vue-table-for |
---|---|
版本号 | v0.1.9 |
发布时间 | 2020年5月19日 |
插件作者 | hunterae |
table-for是一个高度可定制的表构建器组件,可以轻松地为您的记录生成表。
# Yarn
$ yarn add vue-table-for
# NPM
$ npm install vue-table-for --save
首先,您需要vue-table-for
在应用程序中的某处加载:
import Vue from 'vue'
import TableFor from 'vue-table-for'
Vue.use(TableFor)
为记录集合构建一个表。
只需要数据列。标题列将基于数据列自动生成,但可以使用插槽覆盖。
<template>
<table-for
class="table table-bordered"
:records="records"
>
<td name="first_name" />
<td name="last_name" />
<td name="email" />
</table-for>
</template>
<script>
import Axios from 'axios'
export default {
data() {
return {
records: []
}
},
mounted() {
axios
.get(
"https://raw.githubusercontent.com/hunterae/vue-table-for/master/examples/people.json"
)
.then(response => {
this.records = response.data
})
}
}
</script>
v0.1.9(02/22/2021)