Browse Source

修复表情显示的bug

master
xie.bx 2 years ago
parent
commit
594737af3a
  1. 3
      im-ui/src/api/emotion.js
  2. 2
      im-uniapp/common/emotion.js
  3. 2
      im-uniapp/components/chat-item/chat-item.vue

3
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;"/>`
}

2
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

2
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>

Loading…
Cancel
Save