fix: 修复编码器需要重新开关才能使用的问题
This commit is contained in:
@@ -112,7 +112,10 @@ const [useProvideOscilloscope, useOscilloscopeState] = createInjectionState(
|
||||
}
|
||||
|
||||
function getHubProxy() {
|
||||
if (!oscilloscopeHub.value) throw new Error("Hub not initialized");
|
||||
if (!oscilloscopeHub.value) {
|
||||
reinitializeHub();
|
||||
throw new Error("Hub not initialized");
|
||||
}
|
||||
return oscilloscopeHub.value.proxy;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,10 @@ export const useRotaryEncoder = defineStore("RotaryEncoder", () => {
|
||||
}
|
||||
|
||||
function getHubProxy() {
|
||||
if (!rotaryEncoderHub.value) throw new Error("Hub not initialized");
|
||||
if (!rotaryEncoderHub.value) {
|
||||
reinitializeHub();
|
||||
throw new Error("Hub not initialized");
|
||||
}
|
||||
return rotaryEncoderHub.value.proxy;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user