【代码优化】修复我的页面地址列表,点击地址卡片会返回上一页的 bug

pull/71/head
puhui999 2024-08-09 10:10:01 +08:00
parent 1fc3537bf4
commit e7ba7a82e3
2 changed files with 13 additions and 3 deletions

View File

@ -86,7 +86,7 @@
//
function onSelectAddress() {
let emitName = 'SELECT_ADDRESS'
let addressPage = '/pages/user/address/list'
let addressPage = '/pages/user/address/list?type=select';
if (state.value.deliveryType === 2){
emitName = 'SELECT_PICK_UP_INFO'
addressPage = '/pages/user/goods_details_store/index'

View File

@ -39,8 +39,8 @@
</template>
<script setup>
import { reactive, onBeforeMount } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { onBeforeMount, reactive } from 'vue';
import { onShow, onLoad } from '@dcloudio/uni-app';
import sheep from '@/sheep';
import { isEmpty } from 'lodash-es';
import AreaApi from '@/sheep/api/system/area';
@ -49,10 +49,14 @@
const state = reactive({
list: [], //
loading: true,
openType: '', //
});
//
const onSelect = (addressInfo) => {
if (state.openType !== 'select'){ //
return
}
uni.$emit('SELECT_ADDRESS', {
addressInfo,
});
@ -110,6 +114,12 @@
// #endif
}
onLoad((option) => {
if (option.type) {
state.openType = option.type;
}
});
onShow(async () => {
state.list = (await AddressApi.getAddressList()).data;
state.loading = false;