在官方文檔中沒有給出這個組件,但是在源碼中是有的。所以我們可以直接使用:
<el-scrollbar></el-scrollbar>
舉個例子:(高度隨內容自適應)
<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>