emoji-picker.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="emoji-picker">
  3. <view class="emoji-header">
  4. <text class="title">表情</text>
  5. <text class="close" @click="handleClose">关闭</text>
  6. </view>
  7. <view class="emoji-list">
  8. <view
  9. v-for="(emoji, index) in emojiList"
  10. :key="index"
  11. class="emoji-item"
  12. @click="handleEmojiClick(emoji)"
  13. >
  14. <text class="emoji">{{ emoji }}</text>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. name: 'EmojiPicker',
  22. props: {
  23. visible: {
  24. type: Boolean,
  25. default: false
  26. }
  27. },
  28. data() {
  29. return {
  30. // 表情列表
  31. emojiList: [
  32. '😀', '😃', '😄', '😁', '😆', '😅', '😂', '🤣',
  33. '😊', '😇', '🙂', '🙃', '😉', '😌', '😍', '🥰',
  34. '😘', '😗', '😙', '😚', '😋', '😛', '😝', '😜',
  35. '🤪', '🤨', '🧐', '🤓', '😎', '🤩', '🥳', '😏',
  36. '😒', '😞', '😔', '😟', '😕', '🙁', '☹️', '😣',
  37. '😖', '😫', '😩', '🥺', '😢', '😭', '😤', '😠',
  38. '😡', '🤬', '🤯', '😳', '🥵', '🥶', '😱', '😨',
  39. '😰', '😥', '😓', '🤗', '🤔', '🤭', '🤫', '🤥'
  40. ]
  41. }
  42. },
  43. methods: {
  44. // 点击表情
  45. handleEmojiClick(emoji) {
  46. this.$emit('select', emoji);
  47. },
  48. // 点击关闭
  49. handleClose() {
  50. this.$emit('close');
  51. }
  52. }
  53. }
  54. </script>
  55. <style lang="scss" scoped>
  56. .emoji-picker {
  57. background-color: #ffffff;
  58. border-top: 1rpx solid #EEEEEE;
  59. position: fixed;
  60. bottom: 100rpx;
  61. left: 0;
  62. right: 0;
  63. z-index: 999;
  64. .emoji-header {
  65. display: flex;
  66. justify-content: space-between;
  67. align-items: center;
  68. padding: 20rpx 24rpx;
  69. border-bottom: 1rpx solid #F0F0F0;
  70. .title {
  71. font-size: 28rpx;
  72. font-weight: 500;
  73. color: #333333;
  74. }
  75. .close {
  76. font-size: 26rpx;
  77. color: #999999;
  78. }
  79. }
  80. .emoji-list {
  81. display: flex;
  82. flex-wrap: wrap;
  83. padding: 24rpx;
  84. .emoji-item {
  85. width: 20%;
  86. height: 80rpx;
  87. display: flex;
  88. justify-content: center;
  89. align-items: center;
  90. .emoji {
  91. font-size: 40rpx;
  92. }
  93. }
  94. }
  95. }
  96. </style>