当前位置:   article > 正文

uni-app 小程序实现全屏客服按钮随意拖动_uniapp随屏幕滑动按钮

uniapp随屏幕滑动按钮

 xy轴给与初始位置

可以自己封装成组件

  1. <!-- x,y轴 -->
  2. <movable-area class="movableArea">
  3. <movable-view class="movableView" direction="all" x="650rpx" y="800rpx">
  4. <image src="图片.png" mode="widthFix"></image>
  5. <button open-type='contact' class="btn">在线客服</button>
  6. <text style="color: #fff;font-size: 15rpx;margin-top: 5rpx;">在线客服</text>
  7. </movable-view>
  8. </movable-area>
  9. <!-- css -->
  10. .movableArea {
  11. position: fixed;
  12. top: 0;
  13. left: 0;
  14. width: 100%;
  15. height: 100%;
  16. pointer-events: none;
  17. z-index: 99;
  18. .movableView {
  19. pointer-events: auto;
  20. width: 100rpx;
  21. height: 100rpx;
  22. display: flex;
  23. align-items: center;
  24. justify-content: center;
  25. image {
  26. width: 100%;
  27. height: 100%;
  28. }
  29. // 客服
  30. .btn {
  31. width: 50px;
  32. height: 50px;
  33. overflow: hidden;
  34. position: absolute;
  35. left: 0px;
  36. top: 0px;
  37. border-radius: 100%;
  38. opacity: 0;
  39. }
  40. }
  41. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/黑客灵魂/article/detail/767178
推荐阅读
相关标签
  

闽ICP备14008679号