element-ui tree右键菜单
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element
免费下载资源
·
style:
.tree_menu{
position: fixed;
display: block;
z-index: 20000;
background-color: #fff;
padding:5px 0;
border: 1px solid #ebeef5;
border-radius: 4px;
box-shadow:0 2px 12px 0 rgba(0,0,0,.1);
ul{
margin:0;
padding:0;
}
ul li{
list-style: none;
margin:0;
padding:0 15px;
font-size: 14px;
line-height: 30px;
cursor: pointer;
}
ul li:hover{
background-color: #ebeef5
}
}
html:
<el-tree
:data="data"
show-checkbox
node-key="id"
:props="defaultProps"
@node-contextmenu="rightClick"
@check="treeCheck"
>
</el-tree>
<div id="perTreeMenu" v-if="tmDisplay" class="tree_menu" :style="{...rightMenu}">
<ul>
<li><i class="el-icon-tickets"></i> 详情</li>
<li><i class="el-icon-edit"></i> 编辑</li>
</ul>
</div>
js:
rightClick(e,data,node,comp){
console.log('e:',e,'data',data)
this.rightMenu = {top:e.pageY+'px',left:e.pageX+'px'}
this.tmDisplay = true
const self = this
document.onclick=function(ev){
if(ev.target!==document.getElementById('perTreeMenu')){
self.tmDisplay = false
}
}
},
GitHub 加速计划 / eleme / element
54.06 K
14.63 K
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:3 个月前 )
c345bb45
7 个月前
a07f3a59
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update table.md
* Update transition.md
* Update popover.md 7 个月前
更多推荐
已为社区贡献8条内容
所有评论(0)