vue 父组件 子组件数据
数据透视表 (vue-pivot-table)
A vue component for pivot table.
数据透视表的Vue组件。
安装 (Install)
TODO: publish on npm & add npm i --save
command
待办事项:在npm上发布并添加npm i --save
命令
用法 (Usage)
Java脚本 (Javascript)
// Import the component
import Pivot from '@marketconnect/vue-pivot-table' // Not published yet!
export default {
// Register the component
components: { Pivot },
// Basic data for component props
data: () => {
return {
data: Object.freeze([{ x: 0, y: 0, z: 0 }, { x: 1, y: 1, z: 1 }]),
fields: [],
colFields: [{
getter: item => item.x,
label: 'X'
}],
rowFields: [{
getter: item => item.y,
label: 'Y'
}, {
getter: item => item.z,
label: 'Z'
}],
reducer: function(sum, item) {
return sum + 1
}
}
}
...
}
HTML (HTML)
<pivot :data="data" :fields="fields" :row-fields="rowFields" :col-fields="colFields" :reducer="reducer">
<!-- Optional slots can be used for formatting, see documentation below -->
</pivot>