Skip to content

Commit

Permalink
chore: small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 committed Jul 17, 2024
1 parent 237ba75 commit 54485ff
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions packages/compiler-sfc/src/style/cssVars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,18 @@ export function genCssVarsCode(
.join('')

if (isScriptSetup) {
bindings.__hasRefBindingUsedInCssVar = vars.some(varName => {
const type = bindings[varName]
return (
type &&
(type === BindingTypes.SETUP_LET ||
type === BindingTypes.SETUP_MAYBE_REF ||
type === BindingTypes.SETUP_IMPORTED_MAYBE_REF ||
type === BindingTypes.SETUP_REF)
)
Object.defineProperty(bindings, '__hasRefBindingUsedInCssVar', {
enumerable: false,
value: vars.some(varName => {
const type = bindings[varName]
return (
type &&
(type === BindingTypes.SETUP_LET ||
type === BindingTypes.SETUP_MAYBE_REF ||
type === BindingTypes.SETUP_IMPORTED_MAYBE_REF ||
type === BindingTypes.SETUP_REF)
)
}),
})
}
return `_${CSS_VARS_HELPER}(_ctx => (${transformedString}))`
Expand Down

0 comments on commit 54485ff

Please sign in to comment.