mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
2 lines
2.6 KiB
JavaScript
2 lines
2.6 KiB
JavaScript
import{c as f,h,a as x}from"./use-translate.d2900b8c.js";import{t as k,n as m,w as C}from"./with-install.19a35764.js";import{z as _,D as y,e,C as S,r as b,o as P,a as w,w as p,B as t,d as B,F}from"./vue-libs.b44bc779.js";import{V as v}from"./index.8e37fe56.js";import"./constant.80c6de18.js";import"./use-route.82f2be69.js";import"./index.b70c9b40.js";import"./index.4e4daaac.js";const[W,g]=f("progress"),E={color:String,inactive:Boolean,pivotText:String,textColor:String,showPivot:k,pivotColor:String,trackColor:String,strokeWidth:m,percentage:{type:m,default:0,validator:n=>n>=0&&n<=100}},V=_({name:W,props:E,setup(n){const o=y(()=>n.inactive?void 0:n.color),r=()=>{const{textColor:c,pivotText:i,pivotColor:u,percentage:a}=n,d=i!=null?i:`${a}%`;if(n.showPivot&&d){const s={color:c,left:`${+a}%`,transform:`translate(-${+a}%,-50%)`,background:u||o.value};return e("span",{style:s,class:g("pivot",{inactive:n.inactive})},[d])}};return()=>{const{trackColor:c,percentage:i,strokeWidth:u}=n,a={background:c,height:h(u)},d={width:`${i}%`,background:o.value};return e("div",{class:g(),style:a},[e("span",{class:g("portion",{inactive:n.inactive}),style:d},null),r()])}}}),z=C(V),l=z,N={style:{"margin-top":"15px"}},q=_({__name:"index",setup(n){const o=x({"zh-CN":{title2:"\u7F6E\u7070",title3:"\u6837\u5F0F\u5B9A\u5236",strokeWidth:"\u7EBF\u6761\u7C97\u7EC6",transition:"\u8FC7\u6E21\u6548\u679C"},"en-US":{title2:"Inactive",title3:"Custom Style",strokeWidth:"Stroke Width",transition:"Transition"}}),r=S(50),c=a=>Math.min(Math.max(a,0),100),i=()=>{r.value=c(r.value+20)},u=()=>{r.value=c(r.value-20)};return(a,d)=>{const s=b("demo-block");return P(),w(F,null,[e(s,{title:t(o)("basicUsage")},{default:p(()=>[e(t(l),{percentage:50})]),_:1},8,["title"]),e(s,{title:t(o)("strokeWidth")},{default:p(()=>[e(t(l),{percentage:50,"stroke-width":"8"})]),_:1},8,["title"]),e(s,{title:t(o)("title2")},{default:p(()=>[e(t(l),{inactive:"",percentage:50})]),_:1},8,["title"]),e(s,{title:t(o)("title3")},{default:p(()=>[e(t(l),{color:"#f2826a",percentage:25,"pivot-text":t(o)("orange")},null,8,["pivot-text"]),e(t(l),{color:"#ee0a24",percentage:50,"pivot-text":t(o)("red")},null,8,["pivot-text"]),e(t(l),{percentage:75,"pivot-text":t(o)("purple"),"pivot-color":"#7232dd",color:"linear-gradient(to right, #be99ff, #7232dd)"},null,8,["pivot-text"])]),_:1},8,["title"]),e(s,{title:t(o)("transition")},{default:p(()=>[e(t(l),{percentage:r.value},null,8,["percentage"]),B("div",N,[e(t(v),{text:t(o)("add"),type:"primary",size:"small",onClick:i},null,8,["text"]),e(t(v),{text:t(o)("decrease"),type:"danger",size:"small",onClick:u},null,8,["text"])])]),_:1},8,["title"])],64)}}});export{q as default};
|