Skip to content

Commit

Permalink
fix: support styleVars keyName
Browse files Browse the repository at this point in the history
  • Loading branch information
BeADre committed Jun 28, 2021
1 parent aeaa74e commit fa2d4b5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/varlet-ui/src/utils/elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ export function scrollTo(

export function formatStyleVars(styleVars: StyleVars) {
return Object.entries(styleVars).reduce((styles, [key, value]) => {
styles[`--${kebabCase(key)}`] = value
const cssVar = key.startsWith('--') ? key : `--${kebabCase(key)}`
styles[cssVar] = value

return styles
}, {} as StyleVars)
}

0 comments on commit fa2d4b5

Please sign in to comment.