| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <template>
- <view class="tools">
- <button class="tool-btn" @click="showEmojiPicker">
- <image src="/static/emoji.png" alt="Emoji" />
- </button>
- <button class="tool-btn" @click="showPlusMenu">
- <image src="/static/plus.png" alt="More" />
- </button>
- <EmojiPicker v-if="showEmoji" @emoji-selected="insertEmoji" />
- </view>
- </template>
-
- <script>
- import EmojiPicker from './EmojiPicker.vue';
- export default {
- name: 'Tools',
- components: {
- EmojiPicker,
- },
- data() {
- return {
- showEmoji: false,
- };
- },
- methods: {
- showEmojiPicker() {
- this.showEmoji = true;
- // 通知父组件
- // this.$emit('emoji-picker-shown');
- },
- showPlusMenu() {
- // ...
- },
- insertEmoji(emoji) {
- // 插入emoji到文本框或消息中
- // 例如,你可能需要调用一个方法来处理插入emoji
- console.log('Selected emoji:', emoji);
- this.showEmoji = false;
- },
- },
- };
- </script>
-
- <style scoped>
- .tools {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 10px;
- }
-
- .tool-btn {
- width: 40px;
- height: 40px;
- border: none;
- background: none;
- cursor: pointer;
- }
-
- .emoji-picker {
- position: absolute;
- bottom: 50px;
- left: 50%;
- transform: translateX(-50%);
- z-index: 100;
- }
- </style>
|