第一次提交:微信小程序前端最新完整代码

This commit is contained in:
XingQue
2026-06-12 21:55:06 +08:00
commit 84be8489b4
330 changed files with 74263 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
class EmojiDecoder {
emojiMap = null;
url = "";
patterns = [];
metaChars = /[[\]{}()*+?.\\|^$\-,&#\s]/g;
decode = this.decode;
constructor(url,emojiMap) {
this.url = url || '';
this.emojiMap = emojiMap || {};
for (let i in this.emojiMap) {
if (this.emojiMap.hasOwnProperty(i)){
this.patterns.push('('+i.replace(this.metaChars, "\\$&")+')');
}
}
}
decode (text) {
return text.replace(new RegExp(this.patterns.join('|'),'g'), (match) => {
return typeof this.emojiMap[match] != 'undefined' ? '<img height="20rpx" width="20rpx" src="'+this.url+this.emojiMap[match]+'" />' : match;
});
}
}
export default EmojiDecoder