vue3.0 动态css变量的使用

前端开发   发布日期:2025年08月12日   浏览次数:196

setup中定义变量以及在style中的使用(有单位的需要calc 计算)

setup() {
    const rotate = ref<number>(0);
    const color: string = "red";
    const changeStatus = (): void => {
      rotate.value = -90;
    };
    return {
      rotate,
      color,
    };
  },
<style>
.test {
   color: v-bind(color);
   transform: rotateX(calc(v-bind(rotate) * 1deg))
}
</style>

以上就是vue3.0 动态css变量的使用的详细内容,更多关于vue3.0 动态css变量的使用的资料请关注九品源码其它相关文章!