fix: 修复 pywebview 参数序列化问题
This commit is contained in:
@@ -421,7 +421,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, onMounted, onUnmounted, watch } from 'vue'
|
||||
import { ref, reactive, computed, onMounted, onUnmounted, watch, toRaw } from 'vue'
|
||||
import type { AllParameters } from '@/types'
|
||||
import LogComponent from './Log.vue'
|
||||
import Animation from './Animation.vue'
|
||||
@@ -638,8 +638,12 @@ const calculate = async () => {
|
||||
// 后台线程启动计算,实时日志通过 addLogFromBackend 推送
|
||||
// 结果通过 receiveResult 回调接收
|
||||
// 传递动画启用状态
|
||||
// 使用 toRaw 解包响应式对象,确保 pywebview 能正确序列化参数
|
||||
const rawParams = toRaw(params)
|
||||
const paramsWithAnimation = {
|
||||
...params,
|
||||
parameter: toRaw(rawParams.parameter),
|
||||
advance: toRaw(rawParams.advance),
|
||||
optional: toRaw(rawParams.optional),
|
||||
animation_enabled: animationRef.value?.isEnabled() ?? false
|
||||
}
|
||||
await window.pywebview.api.calculate(paramsWithAnimation)
|
||||
|
||||
Reference in New Issue
Block a user