mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
feat: 优化自动操作逻辑,简化组件初始化和事件处理
- 移除了 ClientAutoAction 组件中的状态监视逻辑,直接在挂载时初始化自动操作存储。 - 在 useAutoAction 中增加初始化标志,避免重复初始化。 - 统一了测试事件的基础属性,简化了事件创建逻辑,提升代码可读性。
This commit is contained in:
@@ -452,21 +452,8 @@ function confirmTest() {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const stopWatch = watch(() => danmakuClient.state, (newState) => {
|
||||
if (newState === 'connected') {
|
||||
console.log('[ClientAutoAction] Danmaku client connected, initializing store...');
|
||||
autoActionStore.init();
|
||||
stopWatch();
|
||||
} else if (newState !== 'connecting' && newState !== 'waiting') {
|
||||
console.warn(`[ClientAutoAction] Danmaku client state is ${newState}, auto actions might not work.`);
|
||||
}
|
||||
}, { immediate: true });
|
||||
autoActionStore.init();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
console.log('[ClientAutoAction] Unmounted.');
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user