# tui-col 多端适配 会员组件
介绍
多端适配,适配不同分辨率设备的展示效果。
# 引入
# uni-app引入
第一种,手动引入(可全局引入)
import tuiCol from "@/components/thorui/tui-col/tui-col.vue"
export default {
components:{
tuiCol
}
}
第二种,开启easycom组件模式,如果不了解如何配置,可先查看 官网文档 (opens new window)。
# uni-app版本平台差异说明
App-Nvue | App-vue | H5 | 微信小程序 | 支付宝小程序 | 百度小程序 | 字节小程序 | QQ小程序 |
---|---|---|---|---|---|---|---|
✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
# 微信小程序引入(可在app.json中全局引入)
{
"usingComponents": {
"tui-col": "/components/thorui/tui-col/tui-col"
}
}
# 代码演示
部分功能演示,具体可参考示例程序以及文档API。
左右伸缩,自适应
通过 span
属性设置跨度,24栅格。
<!--uni-app-->
<tui-col :span="12" v-for="(item,index) in 6" :key="index">
<view class="tui-item">https://thorui.cn/doc</view>
</tui-col>
<!--微信小程序-->
<tui-col span="{{12}}" wx:for="{{6}}" wx:key="index">
<view class="tui-item">https://thorui.cn/doc</view>
</tui-col>
分页展现
通过 span
属性设置跨度为12,当xs(max-width:767px)时跨度为24。
<!--uni-app-->
<tui-col :xs="24" :span="12" v-for="(item,index) in 2" :key="index">
<view class="tui-item">{{['A','B'][index]}}</view>
</tui-col>
<!--微信小程序-->
<tui-col xs="{{24}}" span="{{12}}" wx:for="{{2}}" wx:key="index">
<view class="tui-item">{{['A','B'][index]}}</view>
</tui-col>
# Slots
插槽名称 | 说明 |
---|---|
default | 自定义显示内容 |
# Props
属性名 | 类型 | 说明 | 默认值 |
---|---|---|---|
span | Number | 跨度24 | 24 |
offset | Number | margin-left值,取值1~24 | 0 |
pushLeft | Number | left值,取值1~24 | -1 |
pullRight | Number | right值,取值1~24 | -1 |
xs | [Number, Object] | Number:跨度。Object:span、offset、pushLeft、pullRight值。max-width:767px,非Nvue端有效 | -1 |
sm | [Number, Object] | Number:跨度。Object:span、offset、pushLeft、pullRight值。max-width:768px,非Nvue端有效 | -1 |
md | [Number, Object] | Number:跨度。Object:span、offset、pushLeft、pullRight值。max-width:992px,非Nvue端有效 | -1 |
lg | [Number, Object] | Number:跨度。Object:span、offset、pushLeft、pullRight值。max-width:1200px,非Nvue端有效 | -1 |
xl | [Number, Object] | Number:跨度。Object:span、offset、pushLeft、pullRight值。max-width:1920px,非Nvue端有效 | -1 |
# Events
注:uni-app端绑定事件使用@前缀,如@click;微信小程序原生使用bind前缀,如bindclick
事件名 | 说明 | 回调参数 |
---|---|---|
- | - | - |
# 预览
请以移动端效果为准,touch事件目前尚未在PC端做兼容。
# 特别说明
该组件为 会员组件
,非开源内容,需开通会员才可获取使用。
# 线上程序扫码预览
![]() | ![]() | ![]() |
---|---|---|
ThorUI组件库小程序码 | H5二维码 | ThorUI示例小程序码 |