伪元素的点击事件
1.父元素 使用 ‘pointer-events: none;’ 伪元素使用‘pointer-events: auto;’
2.父元素绑定监听事件
$('.layui-picker-title').on('click', function (e) {
$('.layui-picker-view').css({display:'none'});
console.log('-父元素(伪元素点击事件)---单机删除');
});
样式
.layui-picker-title{
text-align: center;
width: 100%;
height: 45px;
line-height: 45px;
background: white;
font-family: "iconfont" !important;
font-size: 14px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
position: relative;
pointer-events: none;
&:before{
pointer-events: auto;
position: absolute;
top: 0;
left: 15px;
content: '\e93c';
font-size: 18px;
font-weight: 500;
color: @theme-color;
}
}