emoji-popup.vue 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view>
  3. <component-popup :propShow="popup_status" propPosition="bottom" @onclose="popup_close_event">
  4. <view class="emoji-popup bg-white">
  5. <view class="close fr oh">
  6. <view class="fr" @tap.stop="popup_close_event">
  7. <icon type="clear" size="20"></icon>
  8. </view>
  9. </view>
  10. <view class="emoji-popup-content oh tc">
  11. <block v-if="emoji_list.length > 0">
  12. <block v-for="(item, index) in emoji_list" :key="index">
  13. <view class="emoji-item fl bs-bb text-size-xxxl" @tap="choice_confirm_event" :data-value="item.emoji">{{item.emoji}}</view>
  14. </block>
  15. </block>
  16. </view>
  17. </view>
  18. </component-popup>
  19. </view>
  20. </template>
  21. <script>
  22. const app = getApp();
  23. var common_static_url = app.globalData.get_static_url('common');
  24. import componentPopup from "../../components/popup/popup";
  25. export default {
  26. data() {
  27. return {
  28. common_static_url: common_static_url,
  29. popup_status: false,
  30. emoji_list: []
  31. };
  32. },
  33. components: {
  34. componentPopup
  35. },
  36. created: function() {},
  37. methods: {
  38. // 初始配置
  39. init(config = {}) {
  40. if(!app.globalData.is_single_page_check()) {
  41. return false;
  42. }
  43. this.setData({
  44. popup_status: config.status == undefined ? true : config.status,
  45. emoji_list: config.emoji_list || [],
  46. });
  47. },
  48. // 弹层关闭
  49. popup_close_event(e) {
  50. this.setData({
  51. popup_status: false
  52. });
  53. },
  54. // 选择确认事件
  55. choice_confirm_event(e) {
  56. // 关闭弹窗
  57. this.setData({
  58. popup_status: false
  59. });
  60. // 调用父级
  61. this.$emit('choiceConfirmEvent', e.currentTarget.dataset.value);
  62. }
  63. }
  64. };
  65. </script>
  66. <style>
  67. .emoji-popup {
  68. padding: 20rpx 10rpx 0 10rpx;
  69. position: relative;
  70. }
  71. .emoji-popup .close {
  72. position: absolute;
  73. top: 20rpx;
  74. right: 20rpx;
  75. z-index: 2;
  76. }
  77. .emoji-popup-content {
  78. max-height: 50vh;
  79. overflow-y: scroll;
  80. overflow-x: hidden;
  81. margin-top: 20rpx;
  82. }
  83. .emoji-popup-content .emoji-item {
  84. height: 130rpx;
  85. line-height: 130rpx;
  86. width: 25%;
  87. }
  88. </style>