Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 2.33 KB

File metadata and controls

34 lines (23 loc) · 2.33 KB

Dynamic css values easy #CSS Features

By webfansplz @webfansplz

Take the Challenge    简体中文

SFC <style> tags support linking CSS values to dynamic components.

Do you know what it is?. Lets try it 👇:

<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: red
}
</style>

Back Share your Solutions Check out Solutions