当前位置:网站首页>Use of component El scrollbar
Use of component El scrollbar
2022-07-24 02:07:00 【PS cool tutorial】
Close test effectively !!!
Original link : Components el-scrollbar Use

Use summary : Many conclusions say that we should give el-srollbar Add a specified height , After a long time , The native horizontal scroll bar always appears below it , Bother it , Finally, refer to the blogger's link above , No problem .
Should be :el-scrollbar You should wrap the elements that need to add scroll bars , If the content of the wrapped direct element exceeds the height of the wrapped element , Then a vertical scroll bar will appear .
Whether the horizontal scroll bar appears or not depends on el-scrollbar And the width of the wrapped direct element . And if you want the horizontal scroll bar to display , Need to add .is-horizontal {display: block; } This style .
<template>
<div>
<el-scrollbar class="scrollbar">
<div class="box">
<ul>
<li v-for="item in 100">{
{ item }}{
{ item }}{
{ item }}{
{ item }}{
{ item }}{
{ item }}{
{ item }}{
{ item }}{
{ item }}{
{ item }}{
{ item }}{
{ item }}{
{ item }}{
{ item }}{
{ item }}{
{ item }}{
{ item }}{
{ item }}{
{ item }}{
{ item }}</li>
</ul>
</div>
</el-scrollbar>
</div>
</template>
<script>
</script>
<style>
.box {
height: 200px;
}
.scrollbar {
width: 200px;
}
.is-horizontal {
display: block;
}
/deep/ .is-horizontal {
display: none;
}
</style>
combination el-table Examples of use
effect 
Several columns are intentionally copied below ,
Used box Put the box around this form , And set up box The height of the box ( The purpose is to get the vertical scroll bar , Because the height of the data stack of the table is greater than box Altitude time , because el-scrollbar The existence of , Will produce a vertical scroll bar , But at this point , The horizontal scroll bar has not appeared .).
Set up box The width is 1200px( because (180 + 180 + 240 )*2 = 1200), And will el-scrollbar The width of is set to 300, such el-scrollbar The width of is less than box Width , A horizontal scroll bar will be generated
<template>
<div>
<div class="wrapper">
<el-scrollbar class="scrollbar">
<div class="box">
<el-table
class="table1"
:data="tableData">
<el-table-column
prop="date"
label=" date "
width="180">
</el-table-column>
<el-table-column
prop="name"
label=" full name "
width="180">
</el-table-column>
<el-table-column
prop="address"
width="240"
label=" Address ">
</el-table-column>
<el-table-column
prop="date"
label=" date "
width="180">
</el-table-column>
<el-table-column
prop="name"
label=" full name "
width="180">
</el-table-column>
<el-table-column
prop="address"
width="240"
label=" Address ">
</el-table-column>
</el-table>
</div>
</el-scrollbar>
</div>
</div>
</template>
<script>
export default {
data() {
return {
tableData: [{
date: '2016-05-02',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1518 get '
}, {
date: '2016-05-04',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1517 get '
}, {
date: '2016-05-01',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1519 get '
}, {
date: '2016-05-03',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1516 get '
}, {
date: '2016-05-02',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1518 get '
}, {
date: '2016-05-04',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1517 get '
}, {
date: '2016-05-01',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1519 get '
}, {
date: '2016-05-03',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1516 get '
}, {
date: '2016-05-02',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1518 get '
}, {
date: '2016-05-04',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1517 get '
}, {
date: '2016-05-01',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1519 get '
}, {
date: '2016-05-03',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1516 get '
}, {
date: '2016-05-02',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1518 get '
}, {
date: '2016-05-04',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1517 get '
}, {
date: '2016-05-01',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1519 get '
}, {
date: '2016-05-03',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1516 get '
}, {
date: '2016-05-02',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1518 get '
}, {
date: '2016-05-04',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1517 get '
}, {
date: '2016-05-01',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1519 get '
}, {
date: '2016-05-03',
name: ' X.h. ',
address: ' Jinshajiang road, putuo district, Shanghai 1516 get '
}]
}
}
}
</script>
<style>
.box {
height: 300px;
width: 1200px;
}
.scrollbar {
width: 300px;
}
.is-horizontal {
display: block;
}
.wrapper {
width: 300px;
border: 1px solid red;
margin: 20px auto;
}
</style>
边栏推荐
- 【MySQL】字符集utf8mb4无法存储表情踩坑记录
- Mysql database authorization learning
- Improvement of DB file sequential read caused by insert
- 架构实战营模块二作业
- Excel simple macro
- Perlin noise and random terrain
- CANopen communication - PDO and SDO
- 分布式资源管理与任务调度框架Yarn
- [MySQL] character set utf8mb4 cannot store the record of expression stepping on the pit
- 响应式布局一个网页在不同设备显示不同效果)meta:vp
猜你喜欢

Construction and test of hfish honey pot

5年接触近百位老板,身为猎头的我,发现升职的秘密不过4个字

Deliver temperature with science and technology, vivo protects the beauty of biodiversity

杂志特稿:元宇宙将重塑我们的生活,我们要确保它变得更好

Thread pool interview

小散量化炒股记|基于多任务爬虫技术, 实现A股实时行情Level1采样

Three document usage

xxl-job使用注意事项

Mysql database UDF authorization learning

Summary of the first change to open source middleware keycloak
随机推荐
Cmake Getting Started tutorial
The difference between.Split (",", -1) and.Split (",")
中小型医院基础网络解决方案
hdu-7141 Ball (bitset)
Construction and test of hfish honey pot
以科技传递温度,vivo守护生物多样性之美
LoadRunner12安装、录制第一个脚本以及代理服务器没有响应解决
145-keep-alive的初步使用
What are the principal guaranteed financial products with an annual interest rate of about 6%?
Using tessellation in unity
MD5 encryption and decryption website test, is MD5 encryption still safe?
新红包封面平台可搭建分站独立后台的源码
Structure the second operation of the actual combat battalion module
利用canvas画图片
STM32概念和安装【第一天】
Writing of graph nodes that trigger different special effects during the day and at night in Tiktok
Cartland number---
Hospital network security architecture
Cinq ans de contact avec près d'une centaine de patrons, en tant que chasseur de têtes, j'a i découvert que le secret de la promotion n'est que quatre mots
Redis 6.0 source code learning simple dynamic string