Address.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <view>
  3. <template v-for="(item, index) in addInfoArr" :key="index">
  4. <add-component ref="addComponentRef"></add-component>
  5. </template>
  6. <view>
  7. <up-button type="primary" text="添加" @click="handleAdd"></up-button>
  8. <up-button type="error" text="确定" @click="handlOk"></up-button>
  9. </view>
  10. </view>
  11. </template>
  12. <script setup>
  13. import {
  14. ref,
  15. reactive
  16. } from 'vue';
  17. import {
  18. useraDdressData
  19. } from "@/api/userSettings.js"
  20. import pickerAddress from '@/components/pickerAddress/pickerAddress.vue' // 地区选择器组件
  21. import addComponent from '@/pages_mine/components/setupUser/Add.vue'
  22. const addComponentRef = ref(null)
  23. const addInfoArr = ref([
  24. {}
  25. ])
  26. function handleAdd() {
  27. if(addInfoArr.value.length < 4 ) addInfoArr.value.push({})
  28. }
  29. const handlOk = async () => {
  30. // const res = await useraDdressData()
  31. // console.log(res,'ok')
  32. const params = []
  33. addInfoArr.value.forEach((item, index) => {
  34. params.push(addComponentRef.value[index].modelForm)
  35. })
  36. console.log(addComponentRef.value, '>>>>>>vaddComponentRef')
  37. console.log(params, '>>>>>>params');
  38. }
  39. </script>
  40. <style scoped lang="scss">
  41. .address-inp {
  42. color: #929292;
  43. }
  44. </style>