Skip to content

Commit

Permalink
fix(style): fix style layout no working
Browse files Browse the repository at this point in the history
  • Loading branch information
wenmine committed Sep 25, 2024
1 parent ebac8f1 commit 36ce0af
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions packages/settings/styles/src/js/useStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,19 +177,21 @@ watch(
)

// 监听全局样式的变化,重新解析
watch(
() => useCanvas().getPageSchema?.()?.css,
(value) => {
state.cssContent = value || ''

// 解析css
const { parseList, selectors, styleObject } = parser(value)

state.cssParseList = parseList
state.selectors = selectors
state.styleObject = styleObject
}
)
setTimeout(() => {
watch(
() => useCanvas().getPageSchema?.()?.css,
(value) => {
state.cssContent = value || ''

// 解析css
const { parseList, selectors, styleObject } = parser(value)

state.cssParseList = parseList
state.selectors = selectors
state.styleObject = styleObject
}
)
}, 0) // 这里需要延时,不然页面初始化的时候,watch不到实际的对象,会使得这里失效

// 计算当前类名下拉列表
watch(
Expand Down

0 comments on commit 36ce0af

Please sign in to comment.