mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
Compare commits
6 Commits
389515bc5b
...
55e937bf2f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55e937bf2f | ||
|
|
19d103670e | ||
|
|
d33b0edc66 | ||
|
|
a92d500034 | ||
|
|
e60fe5f059 | ||
|
|
888424195b |
@@ -90,8 +90,10 @@
|
||||
"eslint": "^9.36.0",
|
||||
"eslint-plugin-oxlint": "^1.19.0",
|
||||
"oxlint": "^1.19.0",
|
||||
"rollup-plugin-visualizer": "^6.0.4",
|
||||
"stylus": "^0.64.0",
|
||||
"typescript": "^5.9.2",
|
||||
"vite-plugin-cdn-import": "^1.0.1",
|
||||
"vue-vine": "^1.7.6"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ComputedRef } from 'vue'
|
||||
import type { ComputedRef, Ref } from 'vue'
|
||||
import type { DanmakuWindowSettings } from '../../store/useDanmakuWindow'
|
||||
import type { EventModel } from '@/api/api-models'
|
||||
import { computed } from 'vue'
|
||||
@@ -67,7 +67,8 @@ export interface BaseDanmakuItemProps {
|
||||
|
||||
export function useDanmakuUtils(
|
||||
props: BaseDanmakuItemProps,
|
||||
emojiData: { data: { inline: { [key: string]: string }, plain: { [key: string]: string } } },
|
||||
emojiData: Ref<{ updateAt?: number, data: { inline: { [key: string]: string }, plain: { [key: string]: string } } }>
|
||||
| { data: { inline: { [key: string]: string }, plain: { [key: string]: string } } },
|
||||
) {
|
||||
// 计算SC弹幕的颜色类
|
||||
const scColorClass = computed(() => {
|
||||
@@ -124,7 +125,12 @@ export function useDanmakuUtils(
|
||||
let match
|
||||
|
||||
try {
|
||||
const availableEmojis = emojiData.data || {} // 确保 emojiData 已加载
|
||||
// 兼容 Ref 和 普通对象两种传参
|
||||
const store = (emojiData as any)?.value ?? emojiData
|
||||
const availableEmojis = (store?.data ?? { inline: {}, plain: {} }) as {
|
||||
inline?: { [key: string]: string }
|
||||
plain?: { [key: string]: string }
|
||||
}
|
||||
|
||||
while ((match = regex.exec(props.item.msg)) !== null) {
|
||||
// 添加表情前的文本部分
|
||||
@@ -133,7 +139,12 @@ export function useDanmakuUtils(
|
||||
}
|
||||
|
||||
const emojiFullName = match[0] // 完整匹配,例如 "[哈哈]"
|
||||
const emojiInfo = availableEmojis.inline[emojiFullName] || availableEmojis.plain[emojiFullName]
|
||||
const emojiName = match[1] // 去除方括号后的名称,例如 "哈哈"
|
||||
// 兼容键名为带/不带方括号的两种情况
|
||||
const emojiInfo = (availableEmojis.inline?.[emojiFullName]
|
||||
?? availableEmojis.inline?.[emojiName]
|
||||
?? availableEmojis.plain?.[emojiFullName]
|
||||
?? availableEmojis.plain?.[emojiName]) as string | undefined
|
||||
|
||||
if (emojiInfo) {
|
||||
// 找到了表情
|
||||
|
||||
6
src/components.d.ts
vendored
6
src/components.d.ts
vendored
@@ -22,13 +22,19 @@ declare module 'vue' {
|
||||
NAvatar: typeof import('naive-ui')['NAvatar']
|
||||
NButton: typeof import('naive-ui')['NButton']
|
||||
NCard: typeof import('naive-ui')['NCard']
|
||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||
NEmpty: typeof import('naive-ui')['NEmpty']
|
||||
NFlex: typeof import('naive-ui')['NFlex']
|
||||
NFormItemGi: typeof import('naive-ui')['NFormItemGi']
|
||||
NGridItem: typeof import('naive-ui')['NGridItem']
|
||||
NIcon: typeof import('naive-ui')['NIcon']
|
||||
NImage: typeof import('naive-ui')['NImage']
|
||||
NPopconfirm: typeof import('naive-ui')['NPopconfirm']
|
||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||
NSpace: typeof import('naive-ui')['NSpace']
|
||||
NTag: typeof import('naive-ui')['NTag']
|
||||
NText: typeof import('naive-ui')['NText']
|
||||
NTime: typeof import('naive-ui')['NTime']
|
||||
PointGoodsItem: typeof import('./components/manage/PointGoodsItem.vue')['default']
|
||||
PointHistoryCard: typeof import('./components/manage/PointHistoryCard.vue')['default']
|
||||
PointOrderCard: typeof import('./components/manage/PointOrderCard.vue')['default']
|
||||
|
||||
@@ -14,7 +14,7 @@ const routes: Array<RouteRecordRaw> = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'index',
|
||||
component: IndexView,
|
||||
component: async () => import('@/views/IndexView.vue'),
|
||||
meta: {
|
||||
title: '你好',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user