uniapp在view外层加一个隐藏的button层


原来的view

class="userText">
   class="t1">微信昵称
   class="t2">15800008888

更改方案

1.添加一个button

 class="userText">
    class="t1">微信昵称
    class="t2">15800008888
    
 

2.对上级userText写样式

    .userText{
        flex: 1;
        padding-left: 20rpx;
        box-sizing: border-box;
        line-height: 55rpx;
        position: relative;
    }

主要是

position: relative;

3.对shareButton写样式

button{
    padding: 0;
}
button::after{border: none;}
.shareButton{
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    right: 0;
    background: none;
}

主要是

position: absolute;

 效果