Using v-bind on styles with Vue 3
Since I started using Vue with version 3, I don't know exactly what I missed in the other 2 versions, but the innovations in version 3 excite me.
It's nice to be able to dynamically use v-bind inside <style> tags.
For example;
<script setup>
import { ref } from "vue"
const textColor = ref('blue')
const changeColor = () => {
textColor.value = 'red'
}
</script>
<template>
<h3>phpexample.net</h3>
<button @click="changeColor">change color</button>
</template>
<style>
h3 {
color: v-bind(textColor)
}
</style>
that's it :)
Comments
Popular Articles
Popular Tags
- #directive
- #Function
- #React
- #Class
- #centOS
- #Json
- #Text
- #API
- #URL
- #Encrypting
- #Redirect
- #Form
- #Special Characters
- #Special
- #Random
- #Generating
- #SASS
- #Version
- #Installation
- #Show
- #
- #Ajax
- #method
- #Logic For Displaying Posts
- #Key
- #DDOS
- #Default Value
- #Comment Line
- #1364 Field
- #Error
- #Abbreviation
- #QR Code Generating
- #Date
- #timeAgo
- #cURL
- #Array
- #Arrays with Key Values to String Statement
- #Short Tag
- #Vite
- #Reading Excel Files
- #Activate
- #Reading
- #Composer
- #Autoloader
- #PSR-4
- #Insert
- #Record
- #Real Time
- #Characters
- #Socket.io
There are no comments, make the firs comment