floatButton.vue 840 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <view>
  3. <movable-area class="movable-area">
  4. <movable-view class="movable-view" :x="x" :y="y" direction="all" @click="handleGoPage">消息通知</movable-view>
  5. </movable-area>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. data() {
  11. return {
  12. x: 300, //x坐标
  13. y: 400 //y坐标
  14. }
  15. },
  16. methods: {
  17. // 点击悬浮按钮回调
  18. handleGoPage() {
  19. uni.navigateTo({
  20. url: '/pagesRepairs/message/message'
  21. })
  22. }
  23. }
  24. }
  25. </script>
  26. <style lang="scss">
  27. $all_width: 96rpx;
  28. $all_height: 96rpx;
  29. .movable-area {
  30. height: calc(100vh - 100rpx);
  31. width: 750rpx;
  32. top: 0;
  33. position: fixed;
  34. pointer-events: none; //此处要加,鼠标事件可以渗透
  35. .movable-view {
  36. background-color: rgba(000, 000, 000, 0.5);
  37. width: $all_width;
  38. height: $all_height;
  39. pointer-events: auto; //恢复鼠标事件
  40. }
  41. }
  42. </style>