块元素
一个用于快速设置宽高比例的组件。该组件只提供布局,不提供样式。
属性
名称 | 类型 | 默认值 | 说明 |
---|---|---|---|
ratio | String | 1:1 | [参考] 宽高比 |
宽高比
宽度和高度的比例,格式为 width:height
或 width/height
。
示例
vue
<template>
<pure-block ratio="16:9">
<view class="content">内容</view>
</pure-block>
<pure-block ratio="16/9">
<view class="content">内容</view>
</pure-block>
</template>
css
.content {
width: 100%;
height: 100%;
background: #ff9900;
color: #ffffff;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
事件
名称 | 参数 | 说明 |
---|---|---|
@onClick | - | 点击时触发 |