vue3中css里的v-bind

2022-08-21 14:50:38 浏览数 (1)

官方文档:状态驱动的动态 CSS

编写一个组件:

代码语言:javascript复制
<template>
    <div class="ruben">
        <p>You clicked {{ count }} times</p>
        <button @click="increment">Click me</button>
    </div>
</template>

<script>
export default {
    data() {
        return {
            count: 1
        }
    },
    methods: {
        increment() {
            this.count  
        }
    }
}
</script>

<style scoped>
.ruben {
    transform: scale(v-bind(count));
}
</style>

测试:

0 人点赞