# tui-wing-blank 左右留白 V2.2.0+ 开源组件
介绍
左右留白,布局组件,主要用于设置内容两侧留白的间距使用。
# 引入
# uni-app引入
第一种,手动引入(可全局引入)
import tuiWingBlank from "@/components/thorui/tui-wing-blank/tui-wing-blank.vue"
export default {
components:{
tuiWingBlank
}
}
第二种,开启easycom组件模式,如果不了解如何配置,可先查看 官网文档 (opens new window)。
# uni-app版本平台差异说明
App-Nvue | App-vue | H5 | 微信小程序 | 支付宝小程序 | 百度小程序 | 字节小程序 | QQ小程序 |
---|---|---|---|---|---|---|---|
✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
# 微信小程序引入(可在app.json中全局引入)
{
"usingComponents": {
"tui-wing-blank": "/components/thorui/tui-wing-blank/tui-wing-blank"
}
}
# 代码演示
部分功能演示,具体可参考示例程序以及文档API。
基础使用
通过 size
属性 设置间距大小。
<tui-wing-blank size="small">
<view class="tui-placeholder">size = small 10rpx</view>
</tui-wing-blank>
.tui-placeholder {
width: 100%;
padding: 20rpx;
box-sizing: border-box;
background: #f2f2f2;
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
color: #999;
}
size = default
通过 margin-top
属性设置margin-top值。
<tui-wing-blank margin-top="24">
<view class="tui-placeholder">size = default 20rpx</view>
</tui-wing-blank>
自定义间距
通过 gap
属性设置自定义左右间距,单位rpx,设置该值则size属性失效。
<tui-wing-blank gap="64">
<view class="tui-placeholder">自定义间距 64rpx</view>
</tui-wing-blank>
# Slots
插槽名称 | 说明 |
---|---|
default | 默认插槽,自定义组件内部展示内容 |
# Props
属性名 | 类型 | 说明 | 默认值 |
---|---|---|---|
size | String | 左右间距大小,可选值:small(10rpx)、default(20rpx)、large(30rpx) | default |
gap | Number, String | 自定义间距大小,单位rpx,设置则size属性失效 | 0 |
background | String | 背景颜色 | transparent |
radius | Number, String | 圆角值,单位rpx | 0 |
marginTop | Number, String | margin-top值,单位rpx | 0 |
marginBottom | Number, String | margin-bottom值,单位rpx | 0 |
# Events
注:uni-app端绑定事件使用@前缀,如@click;微信小程序原生使用bind前缀,如bindclick
事件名 | 说明 | 回调参数 |
---|---|---|
click | 点击组件时触发 | - |
# 预览
请以移动端效果为准,touch事件目前尚未在PC端做兼容。
# 特别说明
# 线上程序扫码预览
![]() | ![]() | ![]() |
---|---|---|
ThorUI组件库小程序码 | H5二维码 | ThorUI示例小程序码 |