demo.6d7f2e12.js 5.0 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.8fd13763.js";import{a,k as l,z as i,s as r,x as m,r as u,o as h,c as w,f as p,q as y}from"./vendor.3b1206fa.js";import"./index.ddf3dff3.js";const{createDemo:f}=d("address");var x=f({props:{},setup(){const e=a({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=a({normal:!1,exist:!1,customImg:!1,other:!1}),s=a({selectedIcon:"heart-fill",defaultIcon:"heart1",closeBtnIcon:"close",backBtnIcon:"left"}),t=l([{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=a({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)}},i(s)),i(n)),i(o)),i(e))}});const C=y();r("data-v-1800d3f2");const g={class:"demo"},N=p("h2",null,"选择自定义地址",-1),v=p("h2",null,"选择已有地址",-1),k=p("h2",null,"自定义图标",-1),b=p("h2",null,"自定义地址与已有地址切换",-1);m();const I=C(((e,o,s,t,n,c)=>{const d=u("nut-cell"),a=u("nut-address");return h(),w("div",g,[N,p(d,{title:"选择地址",desc:e.one,"is-link":"",onClick:e.showAddress},null,8,["desc","onClick"]),p(a,{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,"custom-address-title":"请选择所在地区"},null,8,["show","province","city","country","town","onClose"]),v,p(d,{title:"选择地址",desc:e.two,"is-link":"",onClick:e.showAddressExist},null,8,["desc","onClick"]),p(a,{show:e.exist,"onUpdate:show":o[3]||(o[3]=o=>e.exist=o),type:"exist","exist-address":e.existAddress,onChange:o[4]||(o[4]=o=>e.onChange(o,"exist")),onClose:e.close2,"is-show-custom-address":!1,onSelected:e.selected,"exist-address-title":"配送至"},null,8,["show","exist-address","onClose","onSelected"]),k,p(d,{title:"选择地址",desc:e.three,"is-link":"",onClick:e.showCustomImg},null,8,["desc","onClick"]),p(a,{show:e.customImg,"onUpdate:show":o[5]||(o[5]=o=>e.customImg=o),type:"exist","exist-address":e.existAddress,onChange:o[6]||(o[6]=o=>e.onChange(o,"customImg")),onClose:e.close3,"is-show-custom-address":!1,onSelected:e.selected,"default-icon":e.defaultIcon,"selected-icon":e.selectedIcon,"close-btn-icon":e.closeBtnIcon},null,8,["show","exist-address","onClose","onSelected","default-icon","selected-icon","close-btn-icon"]),b,p(d,{title:"选择地址",desc:e.four,"is-link":"",onClick:e.showAddressOther},null,8,["desc","onClick"]),p(a,{show:e.other,"onUpdate:show":o[7]||(o[7]=o=>e.other=o),type:"exist","exist-address":e.existAddress,province:e.province,city:e.city,country:e.country,town:e.town,"back-btn-icon":e.backBtnIcon,onChange:o[8]||(o[8]=o=>e.onChange(o,"other")),onClose:e.close4,onSelected:e.selected,"custom-and-exist-title":"选择其他地址",onSwitchModule:e.switchModule,onCloseMask:e.closeMask},null,8,["show","exist-address","province","city","country","town","back-btn-icon","onClose","onSelected","onSwitchModule","onCloseMask"])])}));x.render=I,x.__scopeId="data-v-1800d3f2";export default x;