<template>
    <Cn-page :loading='loading'>
        <view slot='body'>
            <view class='index'>
                <view class="content" v-for="(item, index) in formData" :key="index">
                    <uni-forms>
                        <uni-forms-item label="类型">
                            <uni-data-select v-model="item.type" :localdata="range"></uni-data-select>
                        </uni-forms-item>
                        <uni-forms-item label="区域">
                            <uni-easyinput type="textarea" v-model="item.title" placeholder="请输入区域" />
                        </uni-forms-item>
                        <uni-forms-item label="描述">
                            <uni-easyinput type="textarea" v-model="item.des" placeholder="请输入详细描述" />
                        </uni-forms-item>
                    </uni-forms>
                </view>
                <view class="btn-wrap">
                    <view class="btn-wrap-item " @click="submit"> 提交 </view>
                </view>
            </view>
        </view>
    </Cn-page>
</template>
<script>
export default {
    data () {
        return {
            loading: false,
            formData: [
                {
                    title: '',
                    des: '',
                }
            ],
            range: [
                { value: 0, text: "需求" },
                { value: 1, text: "缺陷" },
            ],
        }
    },
    methods: {
        add () {
            this.formData.push({
                type: '',
                address: '',
            })
        },
        submit () {
            console.log(this.formData)
            uni.navigateBack({ delta: 1 })
        },
    }
}
</script>
<style lang='scss'>
.index {
    padding: 20rpx;

    .content {
        margin-bottom: 20rpx;
        padding:  34rpx;
        background: $uni-theme-white;
        border-radius: 12rpx;
    }

    .btn-wrap {
        margin-top: 40rpx;
        display: flex;
        align-items: center;
        justify-content: space-between;

        .btn-wrap-item {
            display: flex;
            align-items: center;
            justify-content: center;
            flex: 1;
            background: $uni-theme-color;
            color: #fff;
            height: 80rpx;
            border-radius: 12rpx;
        }
    }
}
</style>