---
name: View
title: 视图容器
category: 视图容器
owner: 张静媛
---

## 示例

```atom 基础示例

<template>
    <view>
        <view>
            <view class="title">横向布局</view>
            <view class="rowlike">
                <view class="color-a">
                    <text>A</text>
                </view>
                <view class="color-b">
                    <text>B</text>
                </view>
                <view class="color-c">
                    <text>C</text>
                </view>
            </view>
        </view>
        <view>
            <view class="title">纵向布局</view>
            <view class="collike">
                <view class="color-a">
                    <text>A</text>
                </view>
                <view class="color-b">
                    <text>B</text>
                </view>
                <view class="color-c">
                    <text>C</text>
                </view>
            </view>
        </view>
    </view>
</template>

<script type="config">
    {
        components: {
            view: 'components/View/View'
        }
    }
</script>

<style scoped>
.title {
    font-size: .15rem;
    color: #666;
    padding: .3rem .22rem .18rem .22rem;
}
.rowlike {
    width: 90%;
    margin: 0 auto;
    display: flex;
    height: 1.5rem;
    line-height: 1.5rem;
}

.view-title {
    display: block;
    margin: .25rem .18rem .18rem;
    color: #666;
}

.rowlike > div {
    flex: 1;
    text-align: center;
    font-size: .16rem;
    color: #FFF;
}

.collike {
    margin: 0 auto;
    flex-direction: column;
    width: 2.4rem;
}

.collike > div {
    height: 1.2rem;
    line-height: 1.2rem;
    flex: 1;
    text-align: center;
    font-size: .16rem;
    color: #FFF;
}
.color-a {
    background-color: #6895FF;
}
.color-b {
    background-color: #8FB1FF;
}
.color-c {
    background-color: #C3D1FF;
}
</style>

```