pointer-events: none;解决点击失效问题

工作中,做了一个dropdown。在form-select::after里加了一个向下箭头的背景,可是点击箭头时,无法触发dropdown事件。于是添加pointer-events: none;后,可以点击。
记录于此,备忘。

.form-select{
  position: relative;
}
.form-select::after{
  content: "";
  width: 20px;
  height: 20px;
  background: url(../assets/images/drop_down.png);
  background-size:20px 20px;
  background-repeat:no-repeat;
  position: absolute;
  right: 2px;
  top: 9px;
  pointer-events: none;
}

你可能感兴趣的:(pointer-events: none;解决点击失效问题)