vue3新特性 v-bind

v-bind

单文件组件的 <style> 标签支持使用 v-bind CSS 函数将 CSS 的值链接到动态的组件状态

<script setup lang="ts">
const homeWith='100px'
const theme={
  color:'red'
}
</script>

<template>
  <div class="home">
  
  </div>
</template>

<style scoped lang="scss">
.home{
  width: v-bind(homeWith);
  height: 100px;
  background-color: v-bind('theme.color');
}
</style>