2025-04-07 08:30:06 +08:00

83 lines
2.4 KiB
JavaScript
Vendored
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Vue from 'vue';
import Emoji from "./emoji.vue";
import {Modal} from "view-design-hi";
// 加载中的输入框的uid主要用于判断是否最后一个输入框
const inputLoadUid = []
function inputLoadIsLast(uid) {
if (inputLoadUid.length === 0) {
return true
}
const index = inputLoadUid.indexOf(uid)
if (index === -1) {
return false
}
return index === inputLoadUid.length - 1
}
const inputLoadRemove = (uid) => {
const index = inputLoadUid.indexOf(uid)
if (index !== -1) {
inputLoadUid.splice(index, 1)
}
}
const inputLoadAdd = (uid) => {
inputLoadRemove(uid)
inputLoadUid.push(uid)
}
function choiceEmojiOne() {
return new Promise(resolve => {
const Instance = new Vue({
render (h) {
return h(Modal, {
class: 'chat-emoji-one-modal',
props: {
fullscreen: true,
footerHide: true,
},
on: {
'on-visible-change': (v) => {
if (!v) {
setTimeout(_ => {
document.body.removeChild(this.$el);
}, 500)
}
}
}
}, [
h(Emoji, {
attrs: {
onlyEmoji: true
},
on: {
'on-select': (item) => {
this.$children[0].visible = false
if (item.type === 'emoji') {
resolve(item.text)
}
},
}
})
]);
}
});
const component = Instance.$mount();
document.body.appendChild(component.$el);
const modal = Instance.$children[0];
modal.visible = true;
modal.$el.lastChild.addEventListener("click", ({target}) => {
if (target.classList.contains("ivu-modal-body")) {
modal.visible = false
}
});
})
}
export {choiceEmojiOne, inputLoadAdd, inputLoadRemove, inputLoadIsLast}