fix(compiler-sfc): support complex expression in CSS v-bind() (#5114)

fix #5109
This commit is contained in:
edison
2022-01-21 15:53:51 +08:00
committed by Evan You
parent 63210fe41a
commit 95d49bf7e7
3 changed files with 47 additions and 1 deletions

View File

@@ -66,6 +66,27 @@ return { color, width }
}"
`;
exports[`CSS vars injection codegen should work with w/ complex expression 1`] = `
"import { useCssVars as _useCssVars, unref as _unref } from 'vue'
export default {
setup(__props, { expose }) {
expose();
_useCssVars(_ctx => ({
\\"xxxxxxxx-_a___b____2____px__\\": ((_unref(a) + _unref(b)) / 2 + 'px' ),
\\"xxxxxxxx-__a___b______2___a_\\": (((_unref(a) + _unref(b))) / (2 * _unref(a)))
}))
let a = 100
let b = 200
return { a, b }
}
}"
`;
exports[`CSS vars injection codegen w/ <script setup> 1`] = `
"import { useCssVars as _useCssVars, unref as _unref } from 'vue'