<template>
	<view class="project-index">
		<view class="project-item" v-for="(item,index) in list" :key="item.id">
			<uni-data-checkbox class="selet-box" v-model="project" :localdata="[item]" :map="map"></uni-data-checkbox>
		</view>
	</view>
</template>

<script>
	import {
		getProjectList
	} from '@/request/api/project'
	export default {
		data() {
			return {
				list: [],
				project: '',
				map: {
					text: 'name',
					value: 'id'
				}
			}
		},
		onLoad() {
			this.init();
		},
		methods: {
			init() {
				getProjectList().then(res => {
					if (res.code == 200) {
						this.list = res.data;
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.project-index {
		padding: 20rpx 30rpx;

		.project-item {
			background: $uni-white;
			padding: 10rpx 20rpx;
			margin-bottom: 20rpx;
			border-radius: 12rpx;

			.selet-box {
				width: 100%;
			}

			.checklist-box {
				flex: 1;
			}
		}
	}
</style>