样式-动态设置

<template>
    <div>
<h3>style的使用</h3>
<div style="300px; height:200px;margin:10px auto;" :style="{backgroundColor:bgColor,fontSize:fSize}">样式可以是字符串</div>
    </div>
</template>
<script>

export default{
    name:"ClassAndStyle2",
    data(){
        return {
         bgColor:"yellow",
fSize:"10px",

        }
    }
}
</script>
<style scoped>
</style>

  

原文地址:https://www.cnblogs.com/q1359720840/p/13909266.html