mirror of
https://github.com/halo-dev/halo.git
synced 2025-12-20 16:44:38 +08:00
fix: update initial values when form data changes (#5993)
#### What type of PR is this? /area ui /kind bug /milestone 2.16.x #### What this PR does / why we need it: 修复部分表单数据更新时,引用的初始值对象被跟着更新的问题。 #### Does this PR introduce a user-facing change? ```release-note None ```
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
<script lang="ts" setup>
|
||||
import { Toast, VButton, VModal, VSpace } from "@halo-dev/components";
|
||||
import SubmitButton from "@/components/button/SubmitButton.vue";
|
||||
import { computed, nextTick, onMounted, ref, toRaw } from "vue";
|
||||
import { computed, nextTick, onMounted, ref } from "vue";
|
||||
import type { Menu, MenuItem, Ref } from "@halo-dev/api-client";
|
||||
import { apiClient } from "@/utils/api-client";
|
||||
import { setFocus } from "@/formkit/utils/focus";
|
||||
import AnnotationsForm from "@/components/form/AnnotationsForm.vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { cloneDeep } from "lodash-es";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -208,7 +209,7 @@ const onMenuItemSourceChange = () => {
|
||||
|
||||
onMounted(() => {
|
||||
if (props.menuItem) {
|
||||
formState.value = toRaw(props.menuItem);
|
||||
formState.value = cloneDeep(props.menuItem);
|
||||
|
||||
// Set Ref related
|
||||
const { targetRef } = formState.value.spec;
|
||||
|
||||
Reference in New Issue
Block a user