Skip to content

Let's hack <style> #3

@egoist

Description

@egoist

In:

<template>
  <h1>hello</h1>
</template>

<script>
export default {
  props: ['color', 'fontSize']
}
</script>

<style scoped>
h1 {
  color: eval("color");
  font-size: eval("fontSize * 2");
}
</style>

Out:

<template>
  <h1 :style="{'--v0': color, '--v1': fontSize * 2}">hello</h1>
</template>

<script>
export default {
  props: ['color', 'fontSize']
}
</script>

<style scoped>
h1 {
  color: var(--v0);
  font-size: var(--v1);
}
</style>

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions