fix: 修复dropdown内滚动条可以无限向下滚动bug

This commit is contained in:
陈劲松
2020-04-25 11:51:11 +08:00
parent 90c9efd047
commit fa7741ec47
2 changed files with 38 additions and 4 deletions

View File

@@ -13,7 +13,7 @@
<div class="top-tools">
<div class="top-tool-main-left">
<el-dropdown @command="panelChange" class="panel-dropdown-title" trigger="click" placement="bottom-start" v-scrollBar:el-dropdown>
<el-row :gutter="10" class="el-dropdown-link" style="">
<el-row @click.native="scrollbarHeightHandler" :gutter="10" class="el-dropdown-link" style="">
<el-col :span="21" class="panel-list-title" :title="showPanel.name">{{showPanel.name}}</el-col>
<el-col :span="3" style="padding-left:0px !important;"><i class="el-icon-arrow-down el-icon--right"></i></el-col>
</el-row>
@@ -356,7 +356,27 @@
this.$refs.addChartModal.show(true);
this.$refs.addChartModal.createData(this.showPanel.id); //初始化创建图表需要的初始数据
},
scrollbarHeightHandler() {
console.info(1)
setTimeout(() => {
let top = '';
let top2 = '';
document.querySelector("body>.el-dropdown-menu").addEventListener("ps-y-reach-end", () => {
let yDom = document.querySelector("body>.el-dropdown-menu>.ps__rail-y");
let yDom2 = document.querySelector("body>.el-dropdown-menu>.ps__rail-y>.ps__thumb-y");
if (top) {
yDom.style.top = top;
} else {
top = yDom.style.top;
}
if (top2) {
yDom2.style.top = top2;
} else {
top2 = yDom2.style.top;
}
});
}, 100);
},
// 编辑图表信息,打开编辑弹窗
editData(data) {
this.$refs.addChartModal.setTitle(this.$t("dashboard.panel.editChartTitle"));