Selaa lähdekoodia

修复表情显示的bug

xie.bx 2 vuotta sitten
vanhempi
commit
594737af3a

+ 2 - 1
im-ui/src/api/emotion.js

@@ -16,8 +16,9 @@ let textToImg = (emoText) => {
 	let word = emoText.replace(/\#|\;/gi, '');
 	let idx = emoTextList.indexOf(word);
 	if(idx==-1){
-		return "";
+		return emoText;
 	}
+	return emoText;
 	let url = require(`@/assets/emoji/${idx}.gif`);
 	return `<img src="${url}" style="width:40px;height:40px;vertical-align:bottom;"/>`
 }

+ 1 - 1
im-uniapp/common/emotion.js

@@ -18,7 +18,7 @@ let textToImg = (emoText) => {
 	let word = emoText.replace(/\#|\;/gi, '');
 	let idx = emoTextList.indexOf(word);
 	if (idx == -1) {
-		return "";
+		return emoText;
 	}
 	let path = textToPath(emoText);
 	// #ifdef MP

+ 1 - 1
im-uniapp/components/chat-item/chat-item.vue

@@ -9,7 +9,7 @@
 				{{ chat.showName}}
 			</view>
 			<view class="chat-content">
-				<view class="chat-content-text" v-html="$emo.transform(chat.lastContent)"></view>
+				<rich-text class="chat-content-text" :nodes="$emo.transform(chat.lastContent)"></rich-text>
 				<view class="chat-time">{{$date.toTimeText(chat.lastSendTime)}}</view>
 			</view>
 		</view>