注意事项:
1、表格属性类型是方法时,方法中的this说明:
示例:定义表格的对象:
tableOpts:{
...
afterLoadData...
}
写法1:afterLoadData() {console.log(this)}
写法2:等价于写法1 afterLoadData: function() {console.log(this)}
写法3:afterLoadData:()=> {console.log(this)}
写法4:afterLoadData: this.afterLoadDataFn
methods: { afterLoadData() {console.log(this)},}
写法1、2、3:this指向的是表格对象(即tableOpts对象)
写法4:this指向的页面组件,此时方法中可以调用页面的data、methods等等。
2、表格组件自定义封装组件。elementUI的表格属性配置无效。
3、表格高度:表格高度默认填满容器(100%),调整表格高度,需要调整外部容器。