块元素
块元素组件。
比例
通过 ratio 属性设置块元素比例。组件只参与布局,不参与样式设置。
- 可以是
1/1这种格式。 - 也可以是
1:1这种格式。
vue
<template>
<pure-block class="block" ratio="2:1">
<view class="content">内容</view>
</pure-block>
</template>
<style scoped lang="scss">
.block {
width: 180px;
}
.content {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: orange;
color: #ffffff;
}
</style>属性
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
ratio | String | 1/1 | 比例,例如 1:1、2:1 等 |
插槽
| 名称 | 参数 | 说明 |
|---|---|---|
#default | 默认,块元素内容 |