美文网首页
vue3-动态修改style

vue3-动态修改style

作者: PharkiLL | 来源:发表于2021-12-02 11:16 被阅读0次
<template>
  <p @click="changeColor">hello</p>
</template>

<script setup>
import { reactive } from "vue"
const theme = reactive({
  color: 'red'
}) 
 const changeColor = ()=>{
  theme.color="black"
  console.log(theme);

}
</script>



<style scoped>
p {
  color: v-bind('theme.color');
}
</style>

相关文章

网友评论

      本文标题:vue3-动态修改style

      本文链接:https://www.haomeiwen.com/subject/cjvpxrtx.html