Row
组件类型:UxRowComponentPublicInstance
平台兼容性
UniApp X
Android | iOS | web | 鸿蒙 Next | 小程序 |
---|---|---|---|---|
√ | √ | √ | x | √ |
UniApp Vue Nvue
Android | iOS | web | 鸿蒙 Next | 小程序 |
---|---|---|---|---|
x | x | √ | x | x |
Props
属性名 | 类型 | 默认值 | 说明 |
---|---|---|---|
flex | Boolean | false | 弹性盒子 |
gutter | Any | 0 | 栅格间隔 |
justify | String | left | 水平排列方式 |
align | String | center | 垂直对齐方式 |
margin | Array | 边距[上右下左][上下左右][上下左右] | |
mt | Any | 距上单位px | |
mr | Any | 距右单位px | |
mb | Any | 距下单位px | |
ml | Any | 距左单位px | |
padding | Array | 填充[上右下左][上下左右][上下左右] | |
pt | Any | 上内边距单位px | |
pr | Any | 右内边距单位px | |
pb | Any | 下内边距单位px | |
pl | Any | 左内边距单位px | |
xstyle | Array | 自定义样式 |
justify
值 | 说明 |
---|---|
left左对齐 | |
right右对齐 | |
center居中 | |
around间隔相等 | |
between两端对齐 |
align
值 | 说明 |
---|---|
top上对齐 | |
center居中 | |
bottom下对齐 | |
stretch填充 |
Events
事件名 | 说明 | 参数 |
---|---|---|
click | 被点击时触发 |
示例代码
html
<template>
<ux-page :stack="showDoc">
<ux-navbar :title="title" :bold="true">
<template v-slot:right>
<!-- #ifndef MP -->
<ux-button theme="text" icon="/static/tip.png" :icon-size="22" @click="onDoc()"></ux-button>
<!-- #endif -->
</template>
</ux-navbar>
<ux-scroll>
<ux-card direction="column" icon="flag-filled" title="布局" :bold="true">
<ux-text text="支持配置分栏间隔、分栏偏移、对齐方式"></ux-text>
</ux-card>
<ux-card direction="column" icon="arrowright" title="栅格" :bold="true">
<ux-text text="共有12栅格,任意分配,只有 flex=false 时才能开启分栏" :mb="15"></ux-text>
<ux-col>
<ux-row>
<ux-col :flex="false" :span="2">
<view class="cell bg">
<ux-text text="2"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="10">
<view class="cell bg-dark">
<ux-text text="10"></ux-text>
</view>
</ux-col>
</ux-row>
<ux-row :mt="10">
<ux-col :flex="false" :span="4">
<view class="cell bg">
<ux-text text="4"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="4">
<view class="cell bg-dark">
<ux-text text="4"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="4">
<view class="cell bg-light">
<ux-text text="4"></ux-text>
</view>
</ux-col>
</ux-row>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="分栏间隔" :bold="true">
<ux-text text="支持配置分栏间隔" :mb="15"></ux-text>
<ux-col>
<ux-row justify="between" :gutter="10">
<ux-col :flex="false" :span="3" :gutter="10">
<view class="cell bg">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3" :gutter="10">
<view class="cell bg-dark">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3" :gutter="10">
<view class="cell bg-light">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3" :gutter="10">
<view class="cell bg-dark">
<ux-text text="3"></ux-text>
</view>
</ux-col>
</ux-row>
<ux-row :gutter="10" :mt="10">
<ux-col :flex="false" :span="2" :gutter="10">
<view class="cell bg">
<ux-text text="2"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="4" :gutter="10">
<view class="cell bg-dark">
<ux-text text="4"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="6" :gutter="10">
<view class="cell bg-light">
<ux-text text="6"></ux-text>
</view>
</ux-col>
</ux-row>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="分栏偏移" :bold="true">
<ux-text text="支持设置分栏偏移量" :mb="15"></ux-text>
<ux-col>
<ux-row justify="between" :mt="10">
<ux-col :flex="false" :span="3" :offset="3">
<view class="cell bg">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3">
<view class="cell bg-dark">
<ux-text text="3"></ux-text>
</view>
</ux-col>
</ux-row>
<ux-row :mt="10">
<ux-col :flex="false" :span="3">
<view class="cell bg">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3" :offset="3">
<view class="cell bg-dark">
<ux-text text="3"></ux-text>
</view>
</ux-col>
</ux-row>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="对齐" :bold="true">
<ux-text text="支持 justify 和 align 对齐方式" :mb="15"></ux-text>
<ux-col>
<ux-row justify="between" :mt="10">
<ux-col :flex="false" :span="3">
<view class="cell bg">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3">
<view class="cell bg-dark">
<ux-text text="3"></ux-text>
</view>
</ux-col>
</ux-row>
<ux-row justify="around" :mt="10">
<ux-col :flex="false" :span="3">
<view class="cell bg">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3">
<view class="cell bg-dark">
<ux-text text="3"></ux-text>
</view>
</ux-col>
</ux-row>
<ux-row justify="left" :mt="10">
<ux-col :flex="false" :span="3">
<view class="cell bg">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3">
<view class="cell bg-dark">
<ux-text text="3"></ux-text>
</view>
</ux-col>
</ux-row>
<ux-row justify="right" :mt="10">
<ux-col :flex="false" :span="3">
<view class="cell bg">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3">
<view class="cell bg-dark">
<ux-text text="3"></ux-text>
</view>
</ux-col>
</ux-row>
</ux-col>
</ux-card>
<ux-placeholder :height="200">
<ux-row justify="center" align="center" style="height: 100%;">
<ux-text prefix-icon="soapbubble-filled" text="真的没有了~"></ux-text>
</ux-row>
</ux-placeholder>
</ux-scroll>
</ux-page>
</template>
<template>
<ux-page :stack="showDoc">
<ux-navbar :title="title" :bold="true">
<template v-slot:right>
<!-- #ifndef MP -->
<ux-button theme="text" icon="/static/tip.png" :icon-size="22" @click="onDoc()"></ux-button>
<!-- #endif -->
</template>
</ux-navbar>
<ux-scroll>
<ux-card direction="column" icon="flag-filled" title="布局" :bold="true">
<ux-text text="支持配置分栏间隔、分栏偏移、对齐方式"></ux-text>
</ux-card>
<ux-card direction="column" icon="arrowright" title="栅格" :bold="true">
<ux-text text="共有12栅格,任意分配,只有 flex=false 时才能开启分栏" :mb="15"></ux-text>
<ux-col>
<ux-row>
<ux-col :flex="false" :span="2">
<view class="cell bg">
<ux-text text="2"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="10">
<view class="cell bg-dark">
<ux-text text="10"></ux-text>
</view>
</ux-col>
</ux-row>
<ux-row :mt="10">
<ux-col :flex="false" :span="4">
<view class="cell bg">
<ux-text text="4"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="4">
<view class="cell bg-dark">
<ux-text text="4"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="4">
<view class="cell bg-light">
<ux-text text="4"></ux-text>
</view>
</ux-col>
</ux-row>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="分栏间隔" :bold="true">
<ux-text text="支持配置分栏间隔" :mb="15"></ux-text>
<ux-col>
<ux-row justify="between" :gutter="10">
<ux-col :flex="false" :span="3" :gutter="10">
<view class="cell bg">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3" :gutter="10">
<view class="cell bg-dark">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3" :gutter="10">
<view class="cell bg-light">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3" :gutter="10">
<view class="cell bg-dark">
<ux-text text="3"></ux-text>
</view>
</ux-col>
</ux-row>
<ux-row :gutter="10" :mt="10">
<ux-col :flex="false" :span="2" :gutter="10">
<view class="cell bg">
<ux-text text="2"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="4" :gutter="10">
<view class="cell bg-dark">
<ux-text text="4"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="6" :gutter="10">
<view class="cell bg-light">
<ux-text text="6"></ux-text>
</view>
</ux-col>
</ux-row>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="分栏偏移" :bold="true">
<ux-text text="支持设置分栏偏移量" :mb="15"></ux-text>
<ux-col>
<ux-row justify="between" :mt="10">
<ux-col :flex="false" :span="3" :offset="3">
<view class="cell bg">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3">
<view class="cell bg-dark">
<ux-text text="3"></ux-text>
</view>
</ux-col>
</ux-row>
<ux-row :mt="10">
<ux-col :flex="false" :span="3">
<view class="cell bg">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3" :offset="3">
<view class="cell bg-dark">
<ux-text text="3"></ux-text>
</view>
</ux-col>
</ux-row>
</ux-col>
</ux-card>
<ux-card direction="column" icon="arrowright" title="对齐" :bold="true">
<ux-text text="支持 justify 和 align 对齐方式" :mb="15"></ux-text>
<ux-col>
<ux-row justify="between" :mt="10">
<ux-col :flex="false" :span="3">
<view class="cell bg">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3">
<view class="cell bg-dark">
<ux-text text="3"></ux-text>
</view>
</ux-col>
</ux-row>
<ux-row justify="around" :mt="10">
<ux-col :flex="false" :span="3">
<view class="cell bg">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3">
<view class="cell bg-dark">
<ux-text text="3"></ux-text>
</view>
</ux-col>
</ux-row>
<ux-row justify="left" :mt="10">
<ux-col :flex="false" :span="3">
<view class="cell bg">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3">
<view class="cell bg-dark">
<ux-text text="3"></ux-text>
</view>
</ux-col>
</ux-row>
<ux-row justify="right" :mt="10">
<ux-col :flex="false" :span="3">
<view class="cell bg">
<ux-text text="3"></ux-text>
</view>
</ux-col>
<ux-col :flex="false" :span="3">
<view class="cell bg-dark">
<ux-text text="3"></ux-text>
</view>
</ux-col>
</ux-row>
</ux-col>
</ux-card>
<ux-placeholder :height="200">
<ux-row justify="center" align="center" style="height: 100%;">
<ux-text prefix-icon="soapbubble-filled" text="真的没有了~"></ux-text>
</ux-row>
</ux-placeholder>
</ux-scroll>
</ux-page>
</template>
ts
<script setup>
import * as plus from '@/uni_modules/ux-plus'
const title = ref('')
onLoad((e) => {
title.value = e['title'] ?? ''
})
const showDoc = ref(false)
function onDoc() {
plus.openWeb({
title: '在线文档',
url: 'https://www.uxframe.cn/component/layout.html',
// blur: 1,
success: () => {
showDoc.value = true
},
complete: () => {
showDoc.value = false
}
})
}
</script>
<script setup>
import * as plus from '@/uni_modules/ux-plus'
const title = ref('')
onLoad((e) => {
title.value = e['title'] ?? ''
})
const showDoc = ref(false)
function onDoc() {
plus.openWeb({
title: '在线文档',
url: 'https://www.uxframe.cn/component/layout.html',
// blur: 1,
success: () => {
showDoc.value = true
},
complete: () => {
showDoc.value = false
}
})
}
</script>
css
<style lang="scss">
.cell {
height: 30px;
border-radius: 6px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.bg {
background: #ced7e1;
}
.bg-light {
background: #e5e9f2;
}
.bg-dark {
background: #99a9bf;
}
</style>
<style lang="scss">
.cell {
height: 30px;
border-radius: 6px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.bg {
background: #ced7e1;
}
.bg-light {
background: #e5e9f2;
}
.bg-dark {
background: #99a9bf;
}
</style>