Replace JSON.parse(JSON.stringify()) with lodash-es cloneDeep for deep cloning Vue reactive data (S7784)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
|
||||
import { ref, watch } from "vue";
|
||||
import Durationjs from "@/components/DurationInput.vue";
|
||||
import { cloneDeep } from "lodash-es";
|
||||
|
||||
const props = defineProps(["time", "select"]);
|
||||
const emit = defineEmits(["min-total-seconds", "max-total-seconds"]);
|
||||
@@ -55,10 +56,10 @@ const durationMax = ref(null);
|
||||
/** Deep-copies timeData min/max values to the Vue component boundaries. */
|
||||
function setTimeValue() {
|
||||
// Deep copy the original timeData values
|
||||
minVuemin.value = JSON.parse(JSON.stringify(timeData.value.min));
|
||||
minVuemax.value = JSON.parse(JSON.stringify(timeData.value.max));
|
||||
maxVuemin.value = JSON.parse(JSON.stringify(timeData.value.min));
|
||||
maxVuemax.value = JSON.parse(JSON.stringify(timeData.value.max));
|
||||
minVuemin.value = cloneDeep(timeData.value.min);
|
||||
minVuemax.value = cloneDeep(timeData.value.max);
|
||||
maxVuemin.value = cloneDeep(timeData.value.min);
|
||||
maxVuemax.value = cloneDeep(timeData.value.max);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user