1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <template>
- <view>
- <template v-for="(item, index) in addInfoArr" :key="index">
- <add-component ref="addComponentRef"></add-component>
- </template>
-
-
- <view>
- <up-button type="error" text="确定" @click="handlOk" style="Button-btn"></up-button>
- </view>
- </view>
- </template>
- <script setup>
- import {
- ref,
- reactive
- } from 'vue';
- import {
- useraDdressData
- } from "@/api/userSettings.js"
- import pickerAddress from '@/pages_mine/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 params = []
- addInfoArr.value.forEach((item, index) => {
- params.push(addComponentRef.value[index].modelForm)
- })
-
- params.forEach(async (obj) => {
- const res = await useraDdressData(obj)
- if(res.code == 200){
- wx.showToast({
- title: '新增成功',
- icon: 'success', // 或者 'none'
- duration: 1500, // 显示时间,单位毫秒,默认1500
- mask: true, // 是否显示透明蒙层,防止触摸穿透,默认false
- });
- }
- })
- }
- </script>
- <style scoped lang="scss">
-
- .address-inp {
- color: #929292;
- }
- .Button-btn{
- width: 40rpx;
- height: 40rpx;
- }
- </style>
|