<template>
	<view>
		<template v-for="(item, index) in addInfoArr" :key="index">
			<add-component ref="addComponentRef"></add-component>
		</template>
		
	
		<view>
			<up-button type="primary" text="添加" @click="handleAdd"></up-button>
			<up-button type="error" text="确定" @click="handlOk"></up-button>
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive
	} from 'vue';
	import {
		useraDdressData
	} from "@/api/userSettings.js"
	import pickerAddress from '@/components/pickerAddress/pickerAddress.vue' // 地区选择器组件
	import addComponent from '@/pages_mine/components/setupUser/Add.vue'


	const addComponentRef = ref(null)
	
	const addInfoArr = ref([
		{}
	])
	
	function handleAdd() {
		if(addInfoArr.value.length < 4 ) addInfoArr.value.push({})
	}


	const handlOk = async () => {
		// const res = await useraDdressData()
		// console.log(res,'ok')
		
		const params = []
		addInfoArr.value.forEach((item, index) => {
			params.push(addComponentRef.value[index].modelForm)
		})
		
		console.log(addComponentRef.value, '>>>>>>vaddComponentRef')
		console.log(params, '>>>>>>params');
		
	}

</script>
<style scoped lang="scss">
	
.address-inp {
	color: #929292;
}
</style>