Vue3 Element Plus: 使用 ref 和 function 创建带蓝色背景和圆角的 div
<template>
<div :style="divStyle"></div>
</template>
<script setup>
import { ref } from 'vue';
const divStyle = ref({
backgroundColor: 'blue',
borderRadius: '30px',
height: '100%'
});
function setDivStyle() {
divStyle.value = {
backgroundColor: 'blue',
borderRadius: '30px',
height: '100%'
};
}
setDivStyle();
</script>
原文地址: https://www.cveoy.top/t/topic/mCX8 著作权归作者所有。请勿转载和采集!