H5RecorderPopup.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <uni-popup ref="popupRef" type="bottom">
  3. <view class="long-press-box">
  4. <canvas type="2d" class="recwave-WaveView" style="width:300px;height:100px"></canvas>
  5. <!-- @longpress="longPressEvent" -->
  6. <view class="long-press-btn" @longpress="longPressEvent" @touchend="handleTouchEnd"
  7. @touchcancel="handleTouchEnd">
  8. 长按
  9. </view>
  10. </view>
  11. </uni-popup>
  12. </template>
  13. <script>
  14. export default {
  15. data() {
  16. return {
  17. }
  18. },
  19. methods: {
  20. longPressEvent(e) {
  21. console.log(e);
  22. console.log('长按事件触发');
  23. },
  24. handleTouchStart(event) {
  25. console.log('触发长按事件');
  26. // 触发长按事件
  27. // this.longPressTimer = setTimeout(() => {
  28. // this.$emit('longpress');
  29. // }, this.longPressThreshold);
  30. },
  31. handleTouchEnd(event) {
  32. console.log('结束长按事件' , event);
  33. event.preventdefault()
  34. // 清除长按事件计时器
  35. // clearTimeout(this.longPressTimer);
  36. // this.longPressTimer = null;
  37. // // 处理touchend事件
  38. // this.$emit('touchend');
  39. }
  40. },
  41. mounted() {
  42. this.$refs.popupRef.open()
  43. }
  44. }
  45. </script>
  46. <style lang="scss">
  47. .long-press-box {
  48. width: 100%;
  49. padding: 30rpx;
  50. background-color: #fff;
  51. }
  52. .long-press-btn {
  53. width: 100%;
  54. height: 80rpx;
  55. background: linear-gradient(92deg, #3cb7d2 2%, #44c5d5 98%);
  56. border-radius: 40rpx;
  57. font-size: 32rpx;
  58. font-weight: Regular;
  59. text-align: center;
  60. color: #ffffff;
  61. line-height: 80rpx;
  62. }
  63. </style>