Prechádzať zdrojové kódy

改动歌词拖动的处理

lalalashen 3 mesiacov pred
rodič
commit
ea6084c56c
1 zmenil súbory, kde vykonal 9 pridanie a 4 odobranie
  1. 9 4
      pages/makedetail/makeDetail.vue

+ 9 - 4
pages/makedetail/makeDetail.vue

@@ -24,7 +24,7 @@
 		</view>
 
 		<!-- 内容头图区域 -->
-		<view class="topUser">
+		<view class="topUser" ref="ImageBox">
 			<image :src="home_image" class="home_image" mode="aspectFill"></image>
 
 			<!-- 图片指示器 -->
@@ -239,6 +239,9 @@
 				this.audioPlayer.stop();
 				this.audioPlayer.destroy();
 			}
+		},
+		mounted() {
+
 		},
 		methods: {
 			// 返回上一页
@@ -655,12 +658,13 @@
 					const newOffsetY = this.initialOffsetY + deltaY;
 
 					// Get the height of the lyrics text
-					const lyricsTextHeight = this.$refs.lyricsText ? this.$refs.lyricsText.clientHeight : 0;
+					const lyricsTextHeight = this.$refs.lyricsText ? this.$refs.lyricsText.$el.clientHeight : 0;
+					const imageBoxHeight = this.$refs.ImageBox ? this.$refs.ImageBox.$el.clientHeight : 0;
 
 
 					// Define the threshold limits based on the height of the lyrics text
-					const minY = -lyricsTextHeight + 20; // Allow some space above
-					const maxY = 20;  // Allow some space below
+					const minY = -lyricsTextHeight + 50 + imageBoxHeight; // Allow some space above
+					const maxY = lyricsTextHeight/2;  // Allow some space below
 
 					// Apply the limits
 					this.offsetY = Math.min(Math.max(newOffsetY, minY), maxY);
@@ -668,6 +672,7 @@
 					// Log the height and current offset
 					console.log('Lyrics Text Height:', lyricsTextHeight);
 					console.log('Current Offset Y:', this.offsetY);
+					console.log(this);
 				}
 			}
 		}