Browse Source

bugfix: im scroll

able99 4 years ago
parent
commit
406e2c15b4
1 changed files with 7 additions and 1 deletions
  1. 7 1
      jhlive/jhlive.nvue

+ 7 - 1
jhlive/jhlive.nvue

@@ -17,7 +17,7 @@
 		<view class="bottom-message">
 			<!-- 对话信息 --> 
 			<!-- <view class="jhim-message-box"> -->
-			<scroll-view scroll-y="true" v-if="showIm" class="jhim-message-box">
+			<scroll-view :scroll-top="imScrollTop" scroll-y="true" v-if="showIm" class="jhim-message-box">
 			  <view class="jhim-message" v-for="(item, index) in imMsgs.slice(-10)" :key="index">
 				<view class="jhim-message-show" >
 					<!-- <text class="jhim-message-text2">{{item.name}}:</text> -->
@@ -82,6 +82,7 @@
 		//#endif
 		data() {
 			return {
+				imScrollTop: 0,
 				imgs,
 				imInput: '',
 				userSig: '',
@@ -126,6 +127,11 @@
 		unmounted() {
 			this.destroy();
 		},
+		watch: {
+			imMsgs() {
+				this.imScrollTop = 10000+this.imMsgs.length;
+			}
+		},
 		methods: {
 			init() {
 				console.log(LOGTAG + 'init');