demo.ea458a3f.js 4.9 KB

1
  1. var e=Object.defineProperty,o=Object.prototype.hasOwnProperty,s=Object.getOwnPropertySymbols,t=Object.prototype.propertyIsEnumerable,n=(o,s,t)=>s in o?e(o,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[s]=t,c=(e,c)=>{for(var d in c||(c={}))o.call(c,d)&&n(e,d,c[d]);if(s)for(var d of s(c))t.call(c,d)&&n(e,d,c[d]);return e};import{c as d}from"./mobile.e1ddb172.js";import{a as l,k as a,z as r,s as i,x as m,r as u,o as h,c as w,f as p,q as y}from"./vendor.80bf15c7.js";import"./index.42d325ee.js";const{createDemo:C}=d("address");var x=C({props:{},setup(){const e=l({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:[]}),o=l({normal:!1,exist:!1,customImg:!1,other:!1}),s=l({selectedIcon:"heart-fill",defaultIcon:"heart1",closeBtnIcon:"close",backBtnIcon:"left"}),t=a([{id:1,addressDetail:"th ",cityName:"石景山区",countyName:"城区",provinceName:"北京",selectedAddress:!0,townName:""},{id:2,addressDetail:"12_ ",cityName:"电饭锅",countyName:"扶绥县",provinceName:"北京",selectedAddress:!1,townName:""},{id:3,addressDetail:"发大水比 ",cityName:"放到",countyName:"广宁街道",provinceName:"钓鱼岛全区",selectedAddress:!1,townName:""},{id:4,addressDetail:"还是想吧百度吧 ",cityName:"研发",countyName:"八里庄街道",provinceName:"北京",selectedAddress:!1,townName:""}]),n=l({one:"请选择地址",two:"请选择地址",three:"请选择地址",four:"请选择地址"});return c(c(c(c({showAddress:()=>{o.normal=!o.normal},showPopup:o,onChange:(s,t)=>{e[s.next].length<1&&(o[t]=!1)},close1:e=>{console.log(e),n.one=e.data.addressStr},showAddressExist:()=>{o.exist=!0},close2:e=>{if(console.log(e),"exist"==e.type){const{provinceName:o,cityName:s,countyName:t,townName:c,addressDetail:d}=e.data;n.two=o+s+t+c+d}else n.two=e.data.addressStr},selected:(e,o,s)=>{console.log(e),console.log(o)},existAddress:t,showAddressOther:()=>{o.other=!0},showCustomImg:()=>{o.customImg=!0},close3:e=>{if(console.log(e),"exist"==e.type){const{provinceName:o,cityName:s,countyName:t,townName:c,addressDetail:d}=e.data;n.three=o+s+t+c+d}else n.three=e.data.addressStr},close4:e=>{if(console.log(e),"exist"==e.type){const{provinceName:o,cityName:s,countyName:t,townName:c,addressDetail:d}=e.data;n.four=o+s+t+c+d}else n.four=e.data.addressStr},switchModule:e=>{"custom"==e.type?console.log("点击了“选择其他地址”按钮"):console.log("点击了自定义地址左上角的返回按钮")},closeMask:e=>{console.log("关闭弹层",e)}},r(s)),r(n)),r(o)),r(e))}});const g=y("data-v-d57a4b86");i("data-v-d57a4b86");const N={class:"demo"},A=p("h2",null,"选择自定义地址",-1),I=p("h2",null,"选择已有地址",-1),f=p("h2",null,"自定义图标",-1),v=p("h2",null,"自定义地址与已有地址切换",-1);m();const k=g(((e,o,s,t,n,c)=>{const d=u("nut-cell"),l=u("nut-address");return h(),w("div",N,[A,p(d,{title:"选择地址",desc:e.one,"is-link":"",onClick:e.showAddress},null,8,["desc","onClick"]),p(l,{show:e.normal,"onUpdate:show":o[1]||(o[1]=o=>e.normal=o),province:e.province,city:e.city,country:e.country,town:e.town,onChange:o[2]||(o[2]=o=>e.onChange(o,"normal")),onClose:e.close1,customAddressTitle:"请选择所在地区"},null,8,["show","province","city","country","town","onClose"]),I,p(d,{title:"选择地址",desc:e.two,"is-link":"",onClick:e.showAddressExist},null,8,["desc","onClick"]),p(l,{show:e.exist,"onUpdate:show":o[3]||(o[3]=o=>e.exist=o),type:"exist",existAddress:e.existAddress,onChange:o[4]||(o[4]=o=>e.onChange(o,"exist")),onClose:e.close2,isShowCustomAddress:!1,onSelected:e.selected,existAddressTitle:"配送至"},null,8,["show","existAddress","onClose","onSelected"]),f,p(d,{title:"选择地址",desc:e.three,"is-link":"",onClick:e.showCustomImg},null,8,["desc","onClick"]),p(l,{show:e.customImg,"onUpdate:show":o[5]||(o[5]=o=>e.customImg=o),type:"exist",existAddress:e.existAddress,onChange:o[6]||(o[6]=o=>e.onChange(o,"customImg")),onClose:e.close3,isShowCustomAddress:!1,onSelected:e.selected,defaultIcon:e.defaultIcon,selectedIcon:e.selectedIcon,closeBtnIcon:e.closeBtnIcon},null,8,["show","existAddress","onClose","onSelected","defaultIcon","selectedIcon","closeBtnIcon"]),v,p(d,{title:"选择地址",desc:e.four,"is-link":"",onClick:e.showAddressOther},null,8,["desc","onClick"]),p(l,{show:e.other,"onUpdate:show":o[7]||(o[7]=o=>e.other=o),type:"exist",existAddress:e.existAddress,province:e.province,city:e.city,country:e.country,town:e.town,backBtnIcon:e.backBtnIcon,onChange:o[8]||(o[8]=o=>e.onChange(o,"other")),onClose:e.close4,onSelected:e.selected,customAndExistTitle:"选择其他地址",onSwitchModule:e.switchModule,onCloseMask:e.closeMask},null,8,["show","existAddress","province","city","country","town","backBtnIcon","onClose","onSelected","onSwitchModule","onCloseMask"])])}));x.render=k,x.__scopeId="data-v-d57a4b86";export default x;