[Vuejs]-Sass variable does not work if passed from props

0👍

You can’t pass prop to Sass directly. You have to use a dynamic style prop like that:

<template>
   ButtonFilled(:style="{backgroundColor: green}")
   ...
</template>

<script>
export default {
   props: ['green']
   ...
}

...

(you can also refer to this answer)

This will add a background-color CSS property to element with the value of green.

Leave a comment