Skip to content

Commit

Permalink
fix(compiler-sfc): fix useCssVars codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jul 15, 2020
1 parent af4b0c2 commit 9b5ff2b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ exports[`SFC compile <script setup> CSS vars injection <script> w/ default expor
"const __default__ = { setup() {} }
import { useCSSVars as __useCSSVars__ } from 'vue'
const __injectCSSVars__ = () => {
__useCSSVars__(_ctx => ({ color: _ctx.color }))
__useCssVars__(_ctx => ({ color: _ctx.color }))
}
const __setup__ = __default__.setup
__default__.setup = __setup__
Expand All @@ -125,7 +125,7 @@ exports[`SFC compile <script setup> CSS vars injection <script> w/ default expor
import { useCSSVars as __useCSSVars__ } from 'vue'
const __injectCSSVars__ = () => {
__useCSSVars__(_ctx => ({ color: _ctx.color }))
__useCssVars__(_ctx => ({ color: _ctx.color }))
}
const __setup__ = __default__.setup
__default__.setup = __setup__
Expand All @@ -139,7 +139,7 @@ exports[`SFC compile <script setup> CSS vars injection <script> w/ no default ex
const __default__ = {}
import { useCSSVars as __useCSSVars__ } from 'vue'
const __injectCSSVars__ = () => {
__useCSSVars__(_ctx => ({ color: _ctx.color }))
__useCssVars__(_ctx => ({ color: _ctx.color }))
}
const __setup__ = __default__.setup
__default__.setup = __setup__
Expand All @@ -149,11 +149,11 @@ export default __default__"
`;
exports[`SFC compile <script setup> CSS vars injection w/ <script setup> 1`] = `
"import { useCSSVars as __useCSSVars__ } from 'vue'
"import { useCssVars as __useCssVars__ } from 'vue'
export function setup() {
const color = 'red'
__useCSSVars__(_ctx => ({ color }))
__useCssVars__(_ctx => ({ color }))
return { color }
}
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-sfc/src/compileScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ export function compileScript(

// inject `useCSSVars` calls
if (hasCssVars) {
s.prepend(`import { useCSSVars as __useCSSVars__ } from 'vue'\n`)
s.prepend(`import { useCssVars as __useCssVars__ } from 'vue'\n`)
for (const style of styles) {
const vars = style.attrs.vars
if (typeof vars === 'string') {
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-sfc/src/genCssVars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function genCssVarsCode(
})
.join('')

return `__useCSSVars__(_ctx => (${transformedString})${
return `__useCssVars__(_ctx => (${transformedString})${
scoped ? `, true` : ``
})`
}
Expand Down

0 comments on commit 9b5ff2b

Please sign in to comment.