{"id":185431,"date":"2023-09-16T08:18:10","date_gmt":"2023-09-16T00:18:10","guid":{"rendered":"http:\/\/www.idc.net\/help\/185431\/"},"modified":"2023-09-16T08:18:10","modified_gmt":"2023-09-16T00:18:10","slug":"%e5%90%8e%e6%b5%aa%e4%ba%91%e5%b0%8f%e7%a8%8b%e5%ba%8f%e6%95%99%e7%a8%8b%ef%bc%9a%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f-%e6%89%a9%e5%b1%95%e7%bb%84%e4%bb%b6%c2%b7%e4%bb%bf%e5%be%ae%e4%bf%a1","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/185431\/","title":{"rendered":"\u540e\u6d6a\u4e91\u5c0f\u7a0b\u5e8f\u6559\u7a0b\uff1a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f \u6269\u5c55\u7ec4\u4ef6\u00b7\u4eff\u5fae\u4fe1\u8868\u60c5\u7ec4\u4ef6"},"content":{"rendered":"<h2>emoji<\/h2>\n<p>\u4eff\u5fae\u4fe1\u8868\u60c5\u7ec4\u4ef6\u3002\u4f7f\u7528\u524d\u9700\u5c06\u6587\u6863\u4e0b\u65b9\u63d0\u4f9b\u7684\u8868\u60c5\u96ea\u78a7\u56fe\u4e0a\u4f20&nbsp;CDN\uff0c\u518d\u4f20\u5165\u8868\u60c5\u7ec4\u4ef6\u3002\u4e3a\u63d0\u5347\u9996\u6b21\u52a0\u8f7d\u8868\u60c5\u56fe\u7247\u7684\u6027\u80fd\uff0c\u53ef\u901a\u8fc7&nbsp;image&nbsp;\u7ec4\u4ef6\u63d0\u524d\u89e6\u53d1\u96ea\u78a7\u56fe\u7684\u4e0b\u8f7d\uff0c\u5229\u7528\u6d4f\u89c8\u5668\u7684\u7f13\u5b58\u673a\u5236\u3002\u5728\u4e0d\u4f7f\u7528\u8868\u60c5\u9762\u677f\u7684\u9875\u9762\uff0c\u53ef\u5c06&nbsp;emoji&nbsp;\u7ec4\u4ef6\u9690\u85cf\u6216\u79fb\u51fa\u5c4f\u5e55\u5916\uff0c\u4ec5\u4f7f\u7528&nbsp;parseEmoji&nbsp;\u7684\u529f\u80fd\u3002<\/p>\n<h2>\u5c5e\u6027\u5217\u8868<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u5c5e\u6027<\/th>\n<th>\u7c7b\u578b<\/th>\n<th>\u9ed8\u8ba4\u503c<\/th>\n<th>\u5fc5\u586b<\/th>\n<th>\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>source<\/td>\n<td>string<\/td>\n<td><\/td>\n<td>\u662f<\/td>\n<td>\u8868\u60c5\u96ea\u78a7\u56fe\u5730\u5740<\/td>\n<\/tr>\n<tr>\n<td>height<\/td>\n<td>number<\/td>\n<td>300<\/td>\n<td>\u5426<\/td>\n<td>\u8868\u60c5\u76d8\u9ad8\u5ea6<\/td>\n<\/tr>\n<tr>\n<td>background-color<\/td>\n<td>string<\/td>\n<td>#EDEDED<\/td>\n<td>\u5426<\/td>\n<td>\u8868\u60c5\u76d8\u80cc\u666f\u8272<\/td>\n<\/tr>\n<tr>\n<td>show-send<\/td>\n<td>boolean<\/td>\n<td>true<\/td>\n<td>\u5426<\/td>\n<td>\u662f\u5426\u663e\u793a\u53d1\u9001\u6309\u94ae<\/td>\n<\/tr>\n<tr>\n<td>show-del<\/td>\n<td>boolean<\/td>\n<td>true<\/td>\n<td>\u5426<\/td>\n<td>\u662f\u5426\u663e\u793a\u5220\u9664\u6309\u94ae<\/td>\n<\/tr>\n<tr>\n<td>show-history<\/td>\n<td>boolean<\/td>\n<td>true<\/td>\n<td>\u5426<\/td>\n<td>\u662f\u5426\u663e\u793a\u6700\u8fd1\u4f7f\u7528<\/td>\n<\/tr>\n<tr>\n<td>bindinsertemoji<\/td>\n<td>eventhandle<\/td>\n<td><\/td>\n<td>\u5426<\/td>\n<td>\u63d2\u5165\u8868\u60c5\uff0ce.detail={emotionName}<\/td>\n<\/tr>\n<tr>\n<td>binddelemoji<\/td>\n<td>eventhandle<\/td>\n<td><\/td>\n<td>\u5426<\/td>\n<td>\u70b9\u51fb\u5220\u9664\u6309\u94ae<\/td>\n<\/tr>\n<tr>\n<td>bindsend<\/td>\n<td>eventhandle<\/td>\n<td><\/td>\n<td>\u5426<\/td>\n<td>\u70b9\u51fb\u53d1\u9001\u6309\u94ae<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u793a\u4f8b\u4ee3\u7801\uff1a<\/h2>\n<pre><code>{\n  \"disableScroll\": true,\n  \"navigationBarTitleText\": \"\",\n  \"usingComponents\": {\n    \"mp-emoji\": \"..\/components\/emoji\/emoji\"\n\n  }\n}<\/code><\/pre>\n<h2>\n<pre><code>&lt;scroll-view scroll-y style=\"height: {{layoutHeight}}px\" scroll-into-view=\"{{historyList[historyList.length - 1].id}}\"&gt;\n  &lt;block wx:for=\"{{historyList}}\" wx:for-index=\"idx\" wx:for-item=\"historyItem\"&gt;\n    &lt;view class=\"record\" hidden=\"{{historyItem.length === 0}}\" id=\"{{historyItem.id}}\"&gt;\n      &lt;view class=\"avator\"&gt;&lt;\/view&gt;\n      &lt;view class=\"comment\"&gt;\n        &lt;block wx:for=\"{{historyItem.emoji}}\" wx:key=\"*this\"&gt;\n          &lt;block wx:if=\"{{item.type === 1}}\"&gt;{{item.content}}&lt;\/block&gt;\n          &lt;view \n            wx:if=\"{{item.type === 2}}\" \n            style=\"display: inline-block; width: {{lineHeight}}px; height: {{lineHeight}}px\"&gt;\n            &lt;view \n              class=\"{{item.imageClass}}\"\n              style=\"background-image: url({{emojiSource}});transform-origin: 0 0; transform: scale({{lineHeight \/ 64}});\"&gt;&lt;\/view&gt;\n          &lt;\/view&gt;\n        &lt;\/block&gt;\n      &lt;\/view&gt;\n    &lt;\/view&gt;\n  &lt;\/block&gt;&lt;\/scroll-view&gt;\n  \n    &lt;view class=\"reply_wrp\" style=\"bottom: {{keyboardHeight}}px\"&gt;\n      &lt;view class=\"reply_tool\"&gt;\n        &lt;view hover-class=\"active\" class=\"reply_button replay_quick_button\"&gt;\n          &lt;image src=\".\/images\/reply_tool_keyboard.svg\" mode='aspectFit' class=\"reply_tool_pic\"&gt;&lt;\/image&gt;\n        &lt;\/view&gt;\n        &lt;view class=\"reply_form_wrp\"&gt;\n          &lt;label for=\"\" class=\"reply_label\"&gt;\n            &lt;input \n              class=\"reply_input\" \n              cursor-spacing=\"8px\" \n              confirm-type=\"send\" \n              adjust-position=\"{{false}}\" \n              confirm-hold value=\"{{comment}}\" \n              cursor=\"{{cursor}}\" \n              focus=\"{{focus}}\" \n              bindblur=\"onBlur\" \n              bindfocus=\"onFocus\" \n              bindinput=\"onInput\" \n              bindconfirm=\"onConfirm\" \n              bindkeyboardheightchange=\"onkeyboardHeightChange\"\n            \/&gt;\n          &lt;\/label&gt;\n        &lt;\/view&gt;\n        &lt;view hover-class=\"active\" class=\"reply_button replay_emotion_button\" bindtap=\"showEmoji\"&gt;\n          &lt;image src=\".\/images\/reply_tool_emoji.svg\" mode='aspectFit' class=\"reply_tool_pic\"&gt;&lt;\/image&gt;\n        &lt;\/view&gt;\n        &lt;view hover-class=\"active\" class=\"reply_button replay_media_button\" bindtap=\"showFunction\"&gt;\n          &lt;image src=\".\/images\/reply_tool_add.png\" mode='aspectFit' class=\"reply_tool_pic\"&gt;&lt;\/image&gt;\n        &lt;\/view&gt;\n      &lt;\/view&gt;\n      &lt;view class=\"reply_panel_wrp\" style=\"height: {{emojiShow ? 300 : 200}}px;\" hidden=\"{{!emojiShow &amp;&amp; !functionShow}}\"&gt;\n        &lt;view class=\"reply_panel {{emojiShow ? 'show': ''}}\" hidden=\"{{!emojiShow}}\"&gt;\n          &lt;mp-emoji source=\"{{emojiSource}}\" class=\"mp-emoji\" bindinsertemoji=\"insertEmoji\" binddelemoji=\"deleteEmoji\" bindsend=\"onsend\"&gt;&lt;\/mp-emoji&gt;\n        &lt;\/view&gt;\n        &lt;view class=\"reply_panel {{functionShow ? 'show': ''}}\" hidden=\"{{!functionShow}}\"&gt;\n          &lt;swiper indicator-dots=\"{{true}}\" indicator-color=\"#bbbbbb\" indicator-active-color=\"#8c8c8c\"&gt;\n            &lt;swiper-item&gt;\n              &lt;view class=\"function_list\"&gt;\n                &lt;view class=\"function_item\" bindtap=\"chooseImage\"&gt;\n                  &lt;image src=\".\/images\/reply_function_image.svg\" class=\"reply_function_pic\"&gt;&lt;\/image&gt;\n                &lt;\/view&gt;\n              &lt;\/view&gt;\n            &lt;\/swiper-item&gt;\n          &lt;\/swiper&gt;\n        &lt;\/view&gt;\n      &lt;\/view&gt;\n    &lt;\/view&gt;<br><\/code><\/pre>\n<\/h2>\n<h2><\/h2>\n<h2>\u4f7f\u7528\u65b9\u5f0f<\/h2>\n<p>\u70b9\u51fb\u8868\u60c5\u56fe\u6807\u5c06\u4f1a\u83b7\u5f97\u5bf9\u5e94\u7684\u4e2d\u6587\u542b\u4e49\uff0c\u4f8b\u5982????-&gt;[\u5fae\u7b11]\u3002\u5728\u5b9e\u9645\u8f93\u5165\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u901a\u5e38\u4ec5\u5c55\u793a\u4e2d\u6587\u542b\u4e49\u5373\u53ef\u3002<\/p>\n<p>\u5bf9\u6587\u5b57\u548c\u8868\u60c5\u6df7\u5408\u7684\u8bc4\u8bba\u9700\u8981\u89e3\u6790\u540e\u624d\u80fd\u5c55\u793a\uff0c\u7ec4\u4ef6\u5185\u63d0\u4f9b\u4e86&nbsp;parseEmoji&nbsp;\u89e3\u6790\u51fd\u6570\uff0c\u83b7\u53d6\u65b9\u5f0f\u5982\u4e0b\uff1a<\/p>\n<pre><code>\/\/ .mp-emoji \u4e3a\u8868\u60c5\u7ec4\u4ef6\u7684\u9009\u62e9\u5668\nconst emojiInstance = this.selectComponent('.mp-emoji')\nconst emojiNames = emojiInstance.getEmojiNames()\nconst parseEmoji = emojiInstance.parseEmoji\nconst comment = '\u6d4b\u8bd5[\u5f97\u610f][\u5077\u7b11]\u6587\u672c'\nconst parsedCommnet = parseEmoji(comment)\n<\/code><\/pre>\n<p>\u89e3\u6790\u540e\u7684\u8bc4\u8bba\u7ed3\u6784\u5982\u4e0b\uff0c\u6587\u5b57\u548c\u8868\u60c5\u5206\u5272\u6784\u6210\u7684\u6570\u7ec4\uff0ctype=1&nbsp;\u4e3a\u7eaf\u6587\u672c\uff0ctype=2&nbsp;\u4e3a\u8868\u60c5&nbsp;icon\uff0cimageClass&nbsp;\u8bb0\u5f55\u4e86\u8868\u60c5\u5728\u96ea\u78a7\u56fe\u4e0a\u7684\u4f4d\u7f6e\u3002\u9700\u6ce8\u610f\u7684\u662f\u7ec4\u4ef6\u5f00\u542f\u4e86&nbsp;styleIsolation: 'page-shared'\uff0c\u7ec4\u4ef6\u5185\u6837\u5f0f\u4e0e\u9875\u9762\u5171\u4eab\u3002<\/p>\n<pre><code>[\n  {type: 1, content: '\u6d4b\u8bd5'},\n  {type: 2, content: '[\u5f97\u610f]', imageClass: 'smiley_4'},\n  {type: 2, content: '[\u5077\u7b11]', imageClass: 'smiley_20'},\n  {type: 1, content: '\u6587\u672c'},\n]\n<\/code><\/pre>\n<p>\u7531\u4e8e\u8868\u60c5&nbsp;icon&nbsp;\u91c7\u7528\u96ea\u78a7\u56fe\u751f\u6210\uff0c\u5c55\u793a\u65f6\u53ef\u91c7\u7528\u5982\u4e0b\u7684\u7ed3\u6784\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\u6bcf\u4e2a&nbsp;icon&nbsp;\u7684\u5b9e\u9645\u5927\u5c0f\u4e3a 64px\uff0c\u56e0\u6b64\u5728\u6bb5\u843d\u4e2d\u901a\u8fc7&nbsp;scale&nbsp;\u8fdb\u884c\u7f29\u653e\uff0c\u7f29\u653e\u7684\u6bd4\u4f8b\u4e3a \u884c\u9ad8 \/ 64\u3002<\/p>\n<pre><code>&lt;view class=\"comment\"&gt;\n  &lt;block wx:for=\"{{parsedComment}}\" wx:key=\"*this\"&gt;\n    &lt;block wx:if=\"{{item.type === 1}}\"&gt;{{item.content}}&lt;\/block&gt;\n    &lt;view wx:if=\"{{item.type === 2}}\" style=\"display: inline-block; width: {{lineHeight}}px; height: {{lineHeight}}px\"&gt;\n      &lt;view \n        class=\"{{item.imageClass}}\"\n        style=\"background-image: url({{emojiSource}});transform-origin: 0 0; transform: scale({{lineHeight \/ 64}});\"&gt;\n      &lt;\/view&gt;\n    &lt;\/view&gt;\n  &lt;\/block&gt;\n&lt;\/view&gt;\n<\/code><\/pre>\n<pre><code>.comment {\n  font-size: 18px;\n  display: flex;\n  align-items: center;\n  flex-wrap: wrap;\n  line-height: 24px;\n}\n<\/code><\/pre>\n<p>\u5982\u4f55\u4e0e&nbsp;input&nbsp;\u7ed3\u5408\u4f7f\u7528\uff0c\u53c2\u8003\u793a\u4f8b\u4ee3\u7801\u3002<\/p>\n<h3>\u8868\u60c5\u96ea\u78a7\u56fe<\/h3>\n<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>emoji \u4eff\u5fae\u4fe1\u8868\u60c5\u7ec4\u4ef6\u3002\u4f7f\u7528\u524d\u9700\u5c06\u6587\u6863\u4e0b\u65b9\u63d0\u4f9b\u7684\u8868\u60c5\u96ea\u78a7\u56fe\u4e0a\u4f20&nbsp;CDN\uff0c\u518d\u4f20\u5165\u8868\u60c5\u7ec4\u4ef6\u3002\u4e3a\u63d0\u5347\u9996 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":185432,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[182398],"tags":[],"class_list":["post-185431","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mini-program"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/185431","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=185431"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/185431\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media\/185432"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=185431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=185431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=185431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}