vue3 css中如何使用script中的变量

<template>
    <div class='loading1 flex-radio'>
    </div>
</template>
<script setup>

import { ref } from 'vue'
let boxWidth = ref('250px')

</script>
<style scoped>
.loading1 {
    width: v-bind('boxWidth');
    height: 250px;
}

</style>

使用v-bind动态的绑定属性值到css中,实现css动态刷新


版权声明:本文为weixin_46448762原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。