:hover 在移动端中,点击后一直处于hover状态,不会切换。
为此解决:通过:active模拟
<!-- * @Author: lingxie * @Date: 2020-04-23 13:35:57 * @Descripttion: --> <template> <div class="about"> <h1>This is an about page</h1> <div class="btn-hole">按钮</div> </div> </template> <style lang="less"> .btn-click-active { display: block; content: ""; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background: rgba(0, 0, 0, 10%); } .btn-hole { width: 200px; height: 40px; line-height: 40px; text-align: center; background: orange; position: relative; border-radius: 10px; &:active::before { .btn-click-active; } } </style>