mirror of
https://github.com/palxiao/poster-design.git
synced 2025-07-15 16:02:19 +08:00
fix: proxy to object problem
This commit is contained in:
parent
946d9bcf7a
commit
6fb3526a1a
@ -51,6 +51,7 @@ import TabPanel from '@palxp/color-picker/comps/TabPanel.vue'
|
|||||||
import { usePageStore, useWidgetStore } from '@/pinia'
|
import { usePageStore, useWidgetStore } from '@/pinia'
|
||||||
import { TPageState, } from '@/pinia/design/page'
|
import { TPageState, } from '@/pinia/design/page'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
|
import { proxyToObject } from '@/utils/utils'
|
||||||
|
|
||||||
type TState = {
|
type TState = {
|
||||||
activeNames: string[]
|
activeNames: string[]
|
||||||
@ -120,7 +121,7 @@ function onChangeMode(value: string) {
|
|||||||
function change() {
|
function change() {
|
||||||
state.mode = state.modes[0]
|
state.mode = state.modes[0]
|
||||||
state.tag = true
|
state.tag = true
|
||||||
state.innerElement = JSON.parse(JSON.stringify(dActiveElement.value))
|
state.innerElement = proxyToObject(dActiveElement.value || {})
|
||||||
state.innerElement.backgroundImage && (state.mode = state.modes[1])
|
state.innerElement.backgroundImage && (state.mode = state.modes[1])
|
||||||
}
|
}
|
||||||
function changeValue() {
|
function changeValue() {
|
||||||
|
@ -99,7 +99,10 @@ export const proxyToObject = <P extends Record<string, any>>(proxy: P, seen = ne
|
|||||||
seen.set(proxy, obj);
|
seen.set(proxy, obj);
|
||||||
for (let key in proxy) {
|
for (let key in proxy) {
|
||||||
if (proxy.hasOwnProperty(key)) {
|
if (proxy.hasOwnProperty(key)) {
|
||||||
obj[key] = proxyToObject(proxy[key], seen);
|
const value = proxyToObject(proxy[key], seen);
|
||||||
|
if (value !== '[Circular Reference]') {
|
||||||
|
obj[key] = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user