Skip to content

Commit

Permalink
feat: support <style vars scoped>
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Sep 9, 2020
1 parent fb09c8b commit 1692287
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions example/ScriptSetup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<h2>{{ hello }}</h2>
<div>
{{ count }} <button @click="inc">+</button>
<button @click="changeColor">change color</button>
<Button/>
</div>
</template>
Expand All @@ -17,4 +18,15 @@ export function inc() {
}
export const hello = 'hi from script setup'
export const color = ref('red')
export const changeColor = () => {
color.value = color.value === 'red' ? 'green' : 'red'
}
</script>

<style scoped vars="{ color }">
h2 {
color: var(--color)
}
</style>
1 change: 1 addition & 0 deletions src/stylePostLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const StylePostLoader: webpack.loader.Loader = function(source, inMap) {
id: `data-v-${query.id}`,
map: inMap,
scoped: !!query.scoped,
vars: !!query.vars,
trim: true
})

Expand Down

0 comments on commit 1692287

Please sign in to comment.