雖然在官方文檔中沒有給出這個組件,但是在源碼中是有的。所以我們可以直接使用:
<el-scrollbar></el-scrollbar>
但是我們需要微調一下樣式,兩種情況的演示代碼如下:
已知內容高度
<div style='height:800px'><el-scrollbar class='page-component__scroll'></el-scrollbar><div><style>.page-component__scroll{ height: 100%;}.page-component__scroll .el-scrollbar__wrap { overflow-x: auto;}<style>
高度由內容撐開
<html> <body> <div style='height:100%'> <el-scrollbar class='page-component__scroll'></el-scrollbar> <div> </body></html><style>html,body{ height:100% overflow:hidden; /*有效防止在頁面進行手動刷新時顯示內置滾動條*/}.page-component__scroll{ height: 100%;}.page-component__scroll .el-scrollbar__wrap { overflow-x: auto;}<style>
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。
新聞熱點
疑難解答