i tried to make reusable component on Vue.js with sass variable as props like this
ButtonFilled(:title="'Next'" :backgroundColor="'$green'")
however, if the variable is obtained from props like below, it doesn't work at all. is there any solution? By the way, I prefer to use sass variables instead of css variables like this --green
because of some built-in sass functions like lightness ()
, darken ()
etc. Does not support variable css.
<template lang="pug">
router-link.button.button-filled(
:style="customStyling"
to="/"
tag="button"
) {{ title }}
</template>
<script>
export default {
props: {
backgroundColor: { default: "$red", type: String }
},
computed: {
customStyling() {
return [
{ background: `${this.backgroundColor}` }
];
}
}
};
</script>