Skip to content

Commit

Permalink
fix #267 标签过多时会,右键弹出的选项菜单会变形
Browse files Browse the repository at this point in the history
  • Loading branch information
baletu committed Jun 22, 2020
1 parent ce3c912 commit 3247dc8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions simpleui/static/admin/simpleui-x/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,15 +374,27 @@
window.open(url);
},
contextmenu: function (item, e) {
//右键菜单如果x+菜单宽度超过屏幕宽度就默认为屏幕宽度-10-菜单宽度

//home没有popup menu
if (item.id == '0') {
return;
}
this.popup.tab = item;
this.popup.left = e.clientX;
this.popup.top = e.clientY;
this.popup.show = true;
this.$nextTick(function () {
let el = this.$refs.popupmenu;
el.style.width='150px';
let x = e.clientX;

let w= document.body.offsetWidth
if(x+150>w){
x = w - 160;
}

this.popup.left = x;
this.popup.top = e.clientY;
});
},
mainClick: function (e) {
this.popup.show = false;
Expand Down
2 changes: 1 addition & 1 deletion simpleui/templates/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
</el-container>
</el-container>

<ul v-if="popup.show" class="el-dropdown-menu el-popper"
<ul v-if="popup.show" class="el-dropdown-menu el-popper" ref="popupmenu"
:style="{position: 'absolute',top: popup.top+'px',left: popup.left+'px'}" x-placement="top-end">
<li v-for="(item,index) in popup.menus" tabindex="-1" class="el-dropdown-menu__item"
@click="item.handler(popup.tab,item)"><i :class="item.icon"></i><span
Expand Down

0 comments on commit 3247dc8

Please sign in to comment.