vant/v3/assets/index.ba2e57b0.js
2024-04-20 08:49:23 +00:00

2 lines
5.1 KiB
JavaScript

import{V as w}from"./index.bbd81525.js";import{c as B,e as E,p as T,a as y}from"./use-translate.d2900b8c.js";import{t as k,b as I,m as U,w as _}from"./with-install.19a35764.js";import{H as N}from"./constant.80c6de18.js";import{I as V}from"./index.b70c9b40.js";import{p as $,a as H,P as K}from"./index.e6e790ed.js";import{L as z}from"./index.4e4daaac.js";import{z as P,e as n,A as L,q,C,D as x,r as W,o as j,a as G,w as S,B as e,d as J,t as M,F as Q}from"./vue-libs.b44bc779.js";import{T as D}from"./function-call.509e41a7.js";import"./use-route.82f2be69.js";import"./interceptor.f0c85874.js";import"./use-expose.c942d5f8.js";import"./use-touch.04ca7093.js";import"./use-lazy-render.f712e85e.js";import"./on-popup-reopen.138c77eb.js";import"./index.d46e53a8.js";import"./mount-component.f3744995.js";const[R,l]=B("action-sheet"),X=E({},$,{title:String,round:k,actions:I(),closeIcon:U("cross"),closeable:k,cancelText:String,description:String,closeOnPopstate:k,closeOnClickAction:Boolean,safeAreaInsetBottom:k}),Y=[...H,"round","closeOnPopstate","safeAreaInsetBottom"],Z=P({name:R,props:X,emits:["select","cancel","update:show"],setup(a,{slots:t,emit:c}){const u=s=>c("update:show",s),r=()=>{u(!1),c("cancel")},m=()=>{if(a.title)return n("div",{class:l("header")},[a.title,a.closeable&&n(V,{name:a.closeIcon,class:[l("close"),N],onClick:r},null)])},f=()=>{if(t.cancel||a.cancelText)return[n("div",{class:l("gap")},null),n("button",{type:"button",class:l("cancel"),onClick:r},[t.cancel?t.cancel():a.cancelText])]},v=(s,p)=>s.loading?n(z,{class:l("loading-icon")},null):t.action?t.action({action:s,index:p}):[n("span",{class:l("name")},[s.name]),s.subname&&n("div",{class:l("subname")},[s.subname])],F=(s,p)=>{const{color:b,loading:o,callback:d,disabled:i,className:g}=s,O=()=>{i||o||(d&&d(s),a.closeOnClickAction&&u(!1),q(()=>c("select",s,p)))};return n("button",{type:"button",style:{color:b},class:[l("item",{loading:o,disabled:i}),g],onClick:O},[v(s,p)])},A=()=>{if(a.description||t.description){const s=t.description?t.description():a.description;return n("div",{class:l("description")},[s])}};return()=>n(K,L({class:l(),position:"bottom","onUpdate:show":u},T(a,Y)),{default:()=>{var s;return[m(),A(),n("div",{class:l("content")},[a.actions.map(F),(s=t.default)==null?void 0:s.call(t)]),f()]}})}}),tt=_(Z),h=tt,et={class:"demo-action-sheet-content"},bt=P({__name:"index",setup(a){const t=y({"zh-CN":{option1:"\u9009\u9879\u4E00",option2:"\u9009\u9879\u4E8C",option3:"\u9009\u9879\u4E09",subname:"\u63CF\u8FF0\u4FE1\u606F",showCancel:"\u5C55\u793A\u53D6\u6D88\u6309\u94AE",buttonText:"\u5F39\u51FA\u83DC\u5355",customPanel:"\u81EA\u5B9A\u4E49\u9762\u677F",description:"\u8FD9\u662F\u4E00\u6BB5\u63CF\u8FF0\u4FE1\u606F",optionStatus:"\u9009\u9879\u72B6\u6001",coloredOption:"\u7740\u8272\u9009\u9879",disabledOption:"\u7981\u7528\u9009\u9879",showDescription:"\u5C55\u793A\u63CF\u8FF0\u4FE1\u606F"},"en-US":{option1:"Option 1",option2:"Option 2",option3:"Option 3",subname:"Description",showCancel:"Show Cancel Button",buttonText:"Show ActionSheet",customPanel:"Custom Panel",description:"Description",optionStatus:"Option Status",coloredOption:"Colored Option",disabledOption:"Disabled Option",showDescription:"Show Description"}}),c=C(!1),u=C(!1),r=C(!1),m=C(!1),f=C(!1),v=x(()=>[{name:t("option1")},{name:t("option2")},{name:t("option3")}]),F=x(()=>[{name:t("coloredOption"),color:"#ee0a24"},{name:t("disabledOption"),disabled:!0},{loading:!0}]),A=x(()=>[{name:t("option1")},{name:t("option2")},{name:t("option3"),subname:t("subname")}]),s=b=>{c.value=!1,D(b.name)},p=()=>D(t("cancel"));return(b,o)=>{const d=W("demo-block");return j(),G(Q,null,[n(d,{card:"",title:e(t)("basicUsage")},{default:S(()=>[n(e(w),{"is-link":"",title:e(t)("basicUsage"),onClick:o[0]||(o[0]=i=>c.value=!0)},null,8,["title"]),n(e(w),{"is-link":"",title:e(t)("showCancel"),onClick:o[1]||(o[1]=i=>u.value=!0)},null,8,["title"]),n(e(w),{"is-link":"",title:e(t)("showDescription"),onClick:o[2]||(o[2]=i=>f.value=!0)},null,8,["title"])]),_:1},8,["title"]),n(d,{card:"",title:e(t)("optionStatus")},{default:S(()=>[n(e(w),{"is-link":"",title:e(t)("optionStatus"),onClick:o[3]||(o[3]=i=>m.value=!0)},null,8,["title"])]),_:1},8,["title"]),n(d,{card:"",title:e(t)("customPanel")},{default:S(()=>[n(e(w),{"is-link":"",title:e(t)("customPanel"),onClick:o[4]||(o[4]=i=>r.value=!0)},null,8,["title"])]),_:1},8,["title"]),n(e(h),{show:c.value,"onUpdate:show":o[5]||(o[5]=i=>c.value=i),actions:e(v),onSelect:s},null,8,["show","actions"]),n(e(h),{show:u.value,"onUpdate:show":o[6]||(o[6]=i=>u.value=i),actions:e(v),"close-on-click-action":"","cancel-text":e(t)("cancel"),onCancel:p},null,8,["show","actions","cancel-text"]),n(e(h),{show:f.value,"onUpdate:show":o[7]||(o[7]=i=>f.value=i),actions:e(A),"close-on-click-action":"","cancel-text":e(t)("cancel"),description:e(t)("description")},null,8,["show","actions","cancel-text","description"]),n(e(h),{show:m.value,"onUpdate:show":o[8]||(o[8]=i=>m.value=i),"close-on-click-action":"",actions:e(F),"cancel-text":e(t)("cancel")},null,8,["show","actions","cancel-text"]),n(e(h),{show:r.value,"onUpdate:show":o[9]||(o[9]=i=>r.value=i),title:e(t)("title")},{default:S(()=>[J("div",et,M(e(t)("content")),1)]),_:1},8,["show","title"])],64)}}});export{bt as default};