Feat:emoji folder

This commit is contained in:
mattyatea 2023-10-18 20:51:43 +09:00
parent a3743a0622
commit 81182b8612
2 changed files with 50 additions and 25 deletions

View file

@ -153,20 +153,35 @@ const tab = ref<'index' | 'custom' | 'unicode' | 'tags'>('index');
let split_categories = [];
customEmojiCategories.value.forEach(e => {
if (e !== null){
split_categories.push(e.split('/'))
split_categories.push(e.split('/',2))
}
});
const groupedData = {};
split_categories.forEach((item) => {
if (!groupedData[item[0]]) {
groupedData[item[0]] = [];
groupedData[item[0]].push(item[0]);
}else{
groupedData[item[0]].push(item[1]);
if (!groupedData[item[0]]) {
groupedData[item[0]] = {};
groupedData[item[0]][item[0]] = true;
if (item.length > 1) {
for (let i = 1; i < item.length; i++) {
groupedData[item[0]][item[i]] = true;
}
}
} else {
if (item.length > 1) {
for (let i = 1; i < item.length; i++) {
groupedData[item[0]][item[i]] = true;
}
}
}
});
console.log(groupedData)
//
for (const key in groupedData) {
groupedData[key] = Object.keys(groupedData[key]);
}
console.log(split_categories,groupedData)
watch(q, () => {
if (emojisEl.value) emojisEl.value.scrollTop = 0;