dmy 5 年之前
父節點
當前提交
76e39e42a8
共有 2 個文件被更改,包括 15 次插入0 次删除
  1. 10 0
      _src/components/emoji/pc.vue
  2. 5 0
      _src/components/msgItem/style.scss

+ 10 - 0
_src/components/emoji/pc.vue

@@ -21,6 +21,7 @@
 
 <script>
 import { emojiList } from '@/util/emoji'
+import twemoji from 'twemoji'
 
 export default {
   name: 'emojiList',
@@ -32,6 +33,15 @@ export default {
   },
   mounted () {
     this.recentList = JSON.parse(localStorage.getItem('recentEmoji')) || []
+    var ul = document.getElementById('emojiList')
+    twemoji.parse(ul, {
+      callback: function (icon, options) {
+        if (icon.indexOf('-') > -1) {
+          icon = icon.split('-')[0]
+        }
+        return 'https://w2.meechat.me/emoji/' + icon + '.svg?1'
+      }
+    })
   },
   methods: {
     handleClick (name, event) {

+ 5 - 0
_src/components/msgItem/style.scss

@@ -32,6 +32,11 @@
     word-break: normal;
     -ms-word-break: break-all;
     word-break: break-all;
+    .emoji {
+      height: 1em;
+      width: 1em;
+      margin: 0 .05em 0 .1em;
+    }
   }
   img.avatar {
     background: #ccc;