vuejs-challenges icon indicating copy to clipboard operation
vuejs-challenges copied to clipboard

14 - Dynamic css values

Open imamnf opened this issue 11 months ago • 0 comments

<script setup>
import { ref } from "vue"
const theme = ref("red")

const colors = ["blue", "yellow", "red", "green"]

setInterval(() => {
  theme.value = colors[Math.floor(Math.random() * 4)]
}, 1000)

</script>

<template>
  <p>hello</p>
</template>

<style scoped>
/* Modify the code to bind the dynamic color */
p {
  color: v-bind(theme)
}
</style>

imamnf avatar Mar 27 '24 09:03 imamnf