npm install --save emoji-mart-vue-fast

template

//输入框
<el-input v-model="emojisOutput" type="textarea" />
//选择表情
<Picker :data="emojiIndex" set="twitter" @select="showEmoji" />

script setup

// all emoji sets.
import data from "emoji-mart-vue-fast/data/all.json";
// Import default CSS
import "emoji-mart-vue-fast/css/emoji-mart.css";
import { Picker, EmojiIndex } from "emoji-mart-vue-fast/src";

const emojiIndex = new EmojiIndex(data)
const emojisOutput = ref('')
const showEmoji = (emoji)=> {
  emojisOutput.value = emojisOutput.value + emoji.native;
}

node_modules进行二次开发修改

node_modules/emoji-mart-vue-fast/src/components
//我注释了搜索(全部注释,否则报错)和下方介绍页面:search,preview
//标题根据判断改成中文:
Category

      <h3 v-if=" i18n.categories[id] =='Frequently Used'" class="emoji-mart-category-label">最近使用</h3>
      <h3 v-if=" i18n.categories[id] =='Smileys & Emotion'" class="emoji-mart-category-label">微笑与情感</h3>
      <h3 v-if=" i18n.categories[id] =='People & Body'" class="emoji-mart-category-label">人物与肢体</h3>
      <h3 v-if=" i18n.categories[id] =='Animals & Nature'" class="emoji-mart-category-label">动物与自然</h3>
      <h3 v-if=" i18n.categories[id] =='Food & Drink'" class="emoji-mart-category-label">食物与饮料</h3>
      <h3 v-if=" i18n.categories[id] =='Activity'" class="emoji-mart-category-label">活动</h3>
      <h3 v-if=" i18n.categories[id] =='Travel & Places'" class="emoji-mart-category-label">旅行和地点</h3>
      <h3 v-if=" i18n.categories[id] =='Objects'" class="emoji-mart-category-label">物品</h3>
      <h3 v-if=" i18n.categories[id] =='Symbols'" class="emoji-mart-category-label">标志</h3>
      <h3 v-if=" i18n.categories[id] =='Flags'" class="emoji-mart-category-label">旗帜</h3>

GitHub 加速计划 / vu / vue
207.54 K
33.66 K
下载
vuejs/vue: 是一个用于构建用户界面的 JavaScript 框架,具有简洁的语法和丰富的组件库,可以用于开发单页面应用程序和多页面应用程序。
最近提交(Master分支:2 个月前 )
73486cb5 * chore: fix link broken Signed-off-by: snoppy <michaleli@foxmail.com> * Update packages/template-compiler/README.md [skip ci] --------- Signed-off-by: snoppy <michaleli@foxmail.com> Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com> 4 个月前
e428d891 Updated Browser Compatibility reference. The previous currently returns HTTP 404. 5 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐