From 5199a12f8855cd06f24bf355708b5a2134f63176 Mon Sep 17 00:00:00 2001 From: edison Date: Thu, 30 Nov 2023 18:35:20 +0800 Subject: [PATCH] fix(cssVars): cssVar names should be double-escaped when generating code for ssr (#8824) close #7823 --- .../__snapshots__/compileScript.spec.ts.snap | 4 +++- .../compiler-sfc/__tests__/compileScript.spec.ts | 3 +++ packages/compiler-sfc/src/script/utils.ts | 6 ++++-- packages/compiler-sfc/src/style/cssVars.ts | 14 +++++++++++--- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap index 073874363b8..b0076294efe 100644 --- a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap @@ -1003,10 +1003,12 @@ export default { setup(__props) { const count = ref(0) + const style = { color: 'red' } return (_ctx, _push, _parent, _attrs) => { const _cssVars = { style: { - \\"--xxxxxxxx-count\\": (count.value) + \\"--xxxxxxxx-count\\": (count.value), + \\"--xxxxxxxx-style\\\\\\\\.color\\": (style.color) }} _push(\`', () => {