fab-buttom.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <movable-area class="movableArea">
  3. <movable-view class="movableView" inertia out-of-bounds direction="all" :x="phone_W" :y="phone_H">
  4. <slot name="content">
  5. <view class="fab">
  6. <!-- #ifndef MP-ALIPAY -->
  7. <u-button :custom-style="{width:'100rpx',height:'100rpx',borderRadius: '50%'}" hover-class="none"
  8. open-type="contact">
  9. <view class="centerV base-color">
  10. <u-icon name="server-man" size="40rpx"></u-icon>
  11. </view>
  12. </u-button>
  13. <!-- #endif -->
  14. <!-- #ifdef MP-ALIPAY -->
  15. <view class="centerV base-color">
  16. <contact-button tnt-inst-id="n14_MTBR" size="60rpx" scene="SCE01275548" />
  17. </view>
  18. <!-- #endif -->
  19. </view>
  20. </slot>
  21. </movable-view>
  22. </movable-area>
  23. </template>
  24. <script setup>
  25. import {
  26. ref
  27. } from 'vue';
  28. const phone_W = ref(0)
  29. const phone_H = ref(0)
  30. uni.getSystemInfo({
  31. success: res => {
  32. phone_W.value = res.windowWidth
  33. phone_H.value = res.windowHeight
  34. }
  35. })
  36. </script>
  37. <style lang="scss" scoped>
  38. .movableArea {
  39. position: fixed;
  40. top: 0;
  41. left: 0;
  42. width: 90%;
  43. height: 90%;
  44. pointer-events: none; //设置area元素不可点击,则事件便会下移至页面下层元素
  45. z-index: 99999;
  46. }
  47. .movableView {
  48. pointer-events: auto; //可以点击
  49. }
  50. </style>