前言:
在使用vue的框架的時候,其中串列是大家經常使用的功能,但是放到我們專案中的話,也有很多屬性需要我們二次進行改動,
iview:
1、頁面上:官方的話是推薦使用數字或者字串,但我們需要的是動態,所以給他加一個動態值 :height="now_height"
<Table
ref="now_table"
:height="now_height"
>
</Table>
data() {
return {
now_height: null //table高度
};
},
window.innerHeight 當前頁面的高度,
this.$refs.now_table.$el.offsetTop 拿到的是當前指定table的 top值
我這里 -43 -100 是因為我上面還有導航欄還有別的元素,你可以根據你的實際情況
mounted() {
this.now_height = window.innerHeight - this.$refs.now_table.$el.offsetTop - 43 - 100
},
element: 原理同上
<el-table
ref="now_table"
:height="now_height"
>
</el-table>
data() {
return {
now_height: null //table高度
};
},
mounted() {
this.now_height = window.innerHeight - this.$refs.now_table.$el.offsetTop - 43 - 100
},
到此結束!
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/297162.html
標籤:其他
