{"id":19345563,"url":"https://github.com/future-team/ft-emoji","last_synced_at":"2025-04-22T21:32:29.497Z","repository":{"id":57242543,"uuid":"100905890","full_name":"future-team/ft-emoji","owner":"future-team","description":"表情包组件 表情包","archived":false,"fork":false,"pushed_at":"2019-06-11T08:04:34.000Z","size":2156,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-14T06:50:07.593Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/future-team.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-21T02:50:25.000Z","updated_at":"2023-03-29T11:06:22.000Z","dependencies_parsed_at":"2022-09-10T03:51:22.956Z","dependency_job_id":null,"html_url":"https://github.com/future-team/ft-emoji","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/future-team%2Fft-emoji","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/future-team%2Fft-emoji/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/future-team%2Fft-emoji/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/future-team%2Fft-emoji/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/future-team","download_url":"https://codeload.github.com/future-team/ft-emoji/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250328368,"owners_count":21412612,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T04:07:04.329Z","updated_at":"2025-04-22T21:32:29.479Z","avatar_url":"https://github.com/future-team.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FT-EMOJI\n\n表情包项目，目前支持四套表情：emoji、小团、流氓兔、欢乐兔\n功能有：表情包弹出层的渲染、emoji对象提供的parse方法可以解析含有表情的格式化文字\n\n\n## 接口说明\n\n- init 用于Emoji的初始化\n- open 打开Emoji弹出层 （仅限于PC）\n- close 关闭Emoji弹出层\n- parse 用于解析含有emoji的格式化文字，该接口会返回如下富文本\n```html\n\u003ci class=\"emoji-icon emoji-icon-3 emoji-icon-3-15\"\u003e\u003c/i\u003e\n```\n- init(opts) opts为初始化配置对象，以下为opts属性\n- containerId 锚点element的id，PC组件：该id用于点击弹出层以外区域自动关闭的逻辑判断  APP组件：盛放emoji的容器元素的id\n- emojiClickCallback 点击表情的回调，会传入该表情对应的文字，如果需要点击之后关闭弹出层可以在该回调方法里手动调用close方法\n- type 'app'or'pc', 不设置该字段的话默认pc\n\n```js\nimport Emoji from 'ft-emoji/lib/app.js'\nimport PCEmoji from 'ft-emoji/lib/pc.js'\nvar emoji=new Emoji()\nemoji.init({\n        containerId:'emojiContainer',\n        type:'app',\n        emojiClickCallback:function(str){\n            console.log(str)\n        }\n    })\nemoji=new PCEmoji()\nemoji.init({\n        containerId:'emojiTrigger',\n        emojiClickCallback:function(str){\n            console.log(str)\n        }\n    })\nvar emojiTrigger=document.getElementById('emojiTrigger')\nemojiTrigger.addEventListener('click',function(){\n    emoji.open()\n})\nemoji.open()\nvar $result=document.getElementById('result')\nresult.innerHTML=emoji.parse('[OK][小团_OK]小团_OK[流氓兔_再见]流氓兔_再见[欢乐兔_走开]欢乐兔_走开')\n```\n## Demo\n![demo](./emoji-demo.gif)\n\n[线上demo地址](https://future-team.github.io/ft-emoji/examples/dist/)\n\n## 注意事项\n\n全局只应该有一个emoji对象，请勿多次实例化\n如果安装依赖之后抛出handlebar的相关错误，请用npm安装handlebars-loader，并在webpack config文件里的loaders数组里添加\n```js\n{\n   test: /\\.html$/,\n   loader: \"handlebars-loader\"\n}\n```\n\n## 安装\n\n```\n\tnpm install ft-emoji --save\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuture-team%2Fft-emoji","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffuture-team%2Fft-emoji","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuture-team%2Fft-emoji/lists"}