|
@@ -9,12 +9,12 @@
|
|
|
></nut-cell>
|
|
></nut-cell>
|
|
|
|
|
|
|
|
<nut-address
|
|
<nut-address
|
|
|
- v-model:show="showPopup"
|
|
|
|
|
|
|
+ v-model:show="normal"
|
|
|
:province="province"
|
|
:province="province"
|
|
|
:city="city"
|
|
:city="city"
|
|
|
:country="country"
|
|
:country="country"
|
|
|
:town="town"
|
|
:town="town"
|
|
|
- @on-change="cal => onChange(cal, 'showPopup')"
|
|
|
|
|
|
|
+ @on-change="cal => onChange(cal, 'normal')"
|
|
|
@close="close1"
|
|
@close="close1"
|
|
|
customAddressTitle="请选择所在地区"
|
|
customAddressTitle="请选择所在地区"
|
|
|
></nut-address>
|
|
></nut-address>
|
|
@@ -28,10 +28,10 @@
|
|
|
></nut-cell>
|
|
></nut-cell>
|
|
|
|
|
|
|
|
<nut-address
|
|
<nut-address
|
|
|
- v-model:show="showPopupExist"
|
|
|
|
|
|
|
+ v-model:show="exist"
|
|
|
type="exist"
|
|
type="exist"
|
|
|
:existAddress="existAddress"
|
|
:existAddress="existAddress"
|
|
|
- @on-change="cal => onChange(cal, 'showPopupExist')"
|
|
|
|
|
|
|
+ @on-change="cal => onChange(cal, 'exist')"
|
|
|
@close="close2"
|
|
@close="close2"
|
|
|
:isShowCustomAddress="false"
|
|
:isShowCustomAddress="false"
|
|
|
@selected="selected"
|
|
@selected="selected"
|
|
@@ -47,10 +47,10 @@
|
|
|
></nut-cell>
|
|
></nut-cell>
|
|
|
|
|
|
|
|
<nut-address
|
|
<nut-address
|
|
|
- v-model:show="showPopupCustomImg"
|
|
|
|
|
|
|
+ v-model:show="customImg"
|
|
|
type="exist"
|
|
type="exist"
|
|
|
:existAddress="existAddress"
|
|
:existAddress="existAddress"
|
|
|
- @on-change="cal => onChange(cal, 'showPopupCustomImg')"
|
|
|
|
|
|
|
+ @on-change="cal => onChange(cal, 'customImg')"
|
|
|
@close="close3"
|
|
@close="close3"
|
|
|
:isShowCustomAddress="false"
|
|
:isShowCustomAddress="false"
|
|
|
@selected="selected"
|
|
@selected="selected"
|
|
@@ -68,7 +68,7 @@
|
|
|
></nut-cell>
|
|
></nut-cell>
|
|
|
|
|
|
|
|
<nut-address
|
|
<nut-address
|
|
|
- v-model:show="showPopupOther"
|
|
|
|
|
|
|
+ v-model:show="other"
|
|
|
type="exist"
|
|
type="exist"
|
|
|
:existAddress="existAddress"
|
|
:existAddress="existAddress"
|
|
|
:province="province"
|
|
:province="province"
|
|
@@ -76,7 +76,7 @@
|
|
|
:country="country"
|
|
:country="country"
|
|
|
:town="town"
|
|
:town="town"
|
|
|
:backBtnIcon="backBtnIcon"
|
|
:backBtnIcon="backBtnIcon"
|
|
|
- @on-change="cal => onChange(cal, 'showPopupOther')"
|
|
|
|
|
|
|
+ @on-change="cal => onChange(cal, 'other')"
|
|
|
@close="close4"
|
|
@close="close4"
|
|
|
@selected="selected"
|
|
@selected="selected"
|
|
|
customAndExistTitle="选择其他地址"
|
|
customAndExistTitle="选择其他地址"
|
|
@@ -93,33 +93,33 @@ const { createDemo } = createComponent('address');
|
|
|
export default createDemo({
|
|
export default createDemo({
|
|
|
props: {},
|
|
props: {},
|
|
|
setup() {
|
|
setup() {
|
|
|
- const showPopup = ref(false);
|
|
|
|
|
- const province = ref([
|
|
|
|
|
- { id: 1, name: '北京' },
|
|
|
|
|
- { id: 2, name: '广西' },
|
|
|
|
|
- { id: 3, name: '江西' },
|
|
|
|
|
- { id: 4, name: '四川' }
|
|
|
|
|
- ]); // 省
|
|
|
|
|
-
|
|
|
|
|
- const city = ref([
|
|
|
|
|
- { id: 7, name: '朝阳区' },
|
|
|
|
|
- { id: 8, name: '崇文区' },
|
|
|
|
|
- { id: 9, name: '昌平区' },
|
|
|
|
|
- { id: 6, name: '石景山区' }
|
|
|
|
|
- ]); // 市
|
|
|
|
|
-
|
|
|
|
|
- const country = ref([
|
|
|
|
|
- { id: 3, name: '八里庄街道' },
|
|
|
|
|
- { id: 9, name: '北苑' },
|
|
|
|
|
- { id: 4, name: '常营乡' }
|
|
|
|
|
- ]); // 县
|
|
|
|
|
-
|
|
|
|
|
- const town = ref([]); // 镇
|
|
|
|
|
-
|
|
|
|
|
- const showPopupExist = ref(false);
|
|
|
|
|
- const showPopupCustomImg = ref(false);
|
|
|
|
|
|
|
+ const address = reactive({
|
|
|
|
|
+ province: [
|
|
|
|
|
+ { id: 1, name: '北京' },
|
|
|
|
|
+ { id: 2, name: '广西' },
|
|
|
|
|
+ { id: 3, name: '江西' },
|
|
|
|
|
+ { id: 4, name: '四川' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ city: [
|
|
|
|
|
+ { id: 7, name: '朝阳区' },
|
|
|
|
|
+ { id: 8, name: '崇文区' },
|
|
|
|
|
+ { id: 9, name: '昌平区' },
|
|
|
|
|
+ { id: 6, name: '石景山区' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ country: [
|
|
|
|
|
+ { id: 3, name: '八里庄街道' },
|
|
|
|
|
+ { id: 9, name: '北苑' },
|
|
|
|
|
+ { id: 4, name: '常营乡' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ town: []
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- const showPopupOther = ref(false);
|
|
|
|
|
|
|
+ const showPopup = reactive({
|
|
|
|
|
+ normal: false,
|
|
|
|
|
+ exist: false,
|
|
|
|
|
+ customImg: false,
|
|
|
|
|
+ other: false
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
const icon = reactive({
|
|
const icon = reactive({
|
|
|
selectedIcon: 'heart-fill',
|
|
selectedIcon: 'heart-fill',
|
|
@@ -175,40 +175,13 @@ export default createDemo({
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const showAddress = () => {
|
|
const showAddress = () => {
|
|
|
- showPopup.value = !showPopup.value;
|
|
|
|
|
|
|
+ showPopup.normal = !showPopup.normal;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const onChange = (cal, tag) => {
|
|
const onChange = (cal, tag) => {
|
|
|
- let name = province;
|
|
|
|
|
- switch (cal.next) {
|
|
|
|
|
- case 'province':
|
|
|
|
|
- name = province;
|
|
|
|
|
- break;
|
|
|
|
|
- case 'city':
|
|
|
|
|
- name = city;
|
|
|
|
|
- break;
|
|
|
|
|
- case 'country':
|
|
|
|
|
- name = city;
|
|
|
|
|
- break;
|
|
|
|
|
- default:
|
|
|
|
|
- name = town;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- if (name.value.length < 1) {
|
|
|
|
|
- switch (tag) {
|
|
|
|
|
- case 'showPopup':
|
|
|
|
|
- showPopup.value = false;
|
|
|
|
|
- break;
|
|
|
|
|
- case 'showPopupExist':
|
|
|
|
|
- showPopupExist.value = false;
|
|
|
|
|
- break;
|
|
|
|
|
- case 'showPopupCustomImg':
|
|
|
|
|
- showPopupCustomImg.value = false;
|
|
|
|
|
- break;
|
|
|
|
|
- default:
|
|
|
|
|
- showPopupOther.value = false;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const name = address[cal.next];
|
|
|
|
|
+ if (name.length < 1) {
|
|
|
|
|
+ showPopup[tag] = false;
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
const close1 = val => {
|
|
const close1 = val => {
|
|
@@ -217,7 +190,7 @@ export default createDemo({
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const showAddressExist = () => {
|
|
const showAddressExist = () => {
|
|
|
- showPopupExist.value = true;
|
|
|
|
|
|
|
+ showPopup.exist = true;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const close2 = val => {
|
|
const close2 = val => {
|
|
@@ -242,10 +215,10 @@ export default createDemo({
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const showAddressOther = () => {
|
|
const showAddressOther = () => {
|
|
|
- showPopupOther.value = true;
|
|
|
|
|
|
|
+ showPopup.other = true;
|
|
|
};
|
|
};
|
|
|
const showCustomImg = () => {
|
|
const showCustomImg = () => {
|
|
|
- showPopupCustomImg.value = true;
|
|
|
|
|
|
|
+ showPopup.customImg = true;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const close3 = val => {
|
|
const close3 = val => {
|
|
@@ -296,19 +269,12 @@ export default createDemo({
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
showAddress,
|
|
showAddress,
|
|
|
- province,
|
|
|
|
|
- city,
|
|
|
|
|
- country,
|
|
|
|
|
- town,
|
|
|
|
|
showPopup,
|
|
showPopup,
|
|
|
onChange,
|
|
onChange,
|
|
|
close1,
|
|
close1,
|
|
|
showAddressExist,
|
|
showAddressExist,
|
|
|
close2,
|
|
close2,
|
|
|
selected,
|
|
selected,
|
|
|
- showPopupExist,
|
|
|
|
|
- showPopupCustomImg,
|
|
|
|
|
- showPopupOther,
|
|
|
|
|
existAddress,
|
|
existAddress,
|
|
|
showAddressOther,
|
|
showAddressOther,
|
|
|
showCustomImg,
|
|
showCustomImg,
|
|
@@ -317,7 +283,9 @@ export default createDemo({
|
|
|
switchModule,
|
|
switchModule,
|
|
|
closeMask,
|
|
closeMask,
|
|
|
...toRefs(icon),
|
|
...toRefs(icon),
|
|
|
- ...toRefs(text)
|
|
|
|
|
|
|
+ ...toRefs(text),
|
|
|
|
|
+ ...toRefs(showPopup),
|
|
|
|
|
+ ...toRefs(address)
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|