vue实现一个宽1px高20px的线
在Vue中,可以使用以下方式实现一个宽1px高20px的线:
- 使用样式属性:
<template>
<div class="line"></div>
</template>
<style>
.line {
width: 1px;
height: 20px;
background-color: black;
}
</style>
- 使用内联样式:
<template>
<div :style="{ width: '1px', height: '20px', backgroundColor: 'black' }"></div>
</template>
无论是使用样式属性还是内联样式,都可以实现一个宽1px高20px的线。
原文地址: http://www.cveoy.top/t/topic/fhyb 著作权归作者所有。请勿转载和采集!