Sticky for element-ui table
npm install element-ui-sticky-table```
yarn add element-ui-sticky-table
`js
import Vue from "vue";
import StickyTable from "element-ui-sticky-table";
// global registration
Vue.component("sticky-table", StickyTable);
// or directly override el-table (StickyTable is a superset of ElTable)
Vue.component("el-table", StickyTable);
`
All you need to do is add sticky prop to !
`html`
`javascript`
export default {
data() {
return {
tableData: [
{
date: "2016-05-03",
name: "Tom",
address: "No. 189, Grove St, Los Angeles",
},
{
date: "2016-05-02",
name: "Tom",
address: "No. 189, Grove St, Los Angeles",
},
{
date: "2016-05-04",
name: "Tom",
address: "No. 189, Grove St, Los Angeles",
},
],
};
},
};
``
cd examples
yarn install
yarn dev
sticky: boolean = false: Whether the table should be sticky.
sticky-offset-top: number = 0`: apply offset top, this would be useful when you have fixed element to be offset from.