2 lines
3.1 KiB
JavaScript
2 lines
3.1 KiB
JavaScript
import{_ as I,r,a2 as V,ah as M,d as i,o as p,c as E,l as N,k,f as _,J as U,m as C,e as c,w as d,O as j}from"./index.9f28707e.js";const J={class:"LeftBox"},O={class:"RightBox"},q={__name:"TimeLine2",props:{bgcolor:{type:String,default:"dark"},nowValue:{type:String,default:""},yearArr:{type:Array,default:()=>[]},second:{type:Number,default:1e3}},emits:["handleNowValueChange"],setup(L,{emit:t}){const l=L;let f=null,s=r(5),o=r(1),a=r(0),B=r(0),m=r(100);const b=r({});let v=r(!1),e=r([]);const z=n=>{switch(n){case 0:console.log("0"),t("handleNowValueChange",e.value[0]);break;case 25:console.log("25"),t("handleNowValueChange",e.value[1]);break;case 50:console.log("50"),t("handleNowValueChange",e.value[2]);break;case 75:console.log("75"),t("handleNowValueChange",e.value[3]);break;case 100:console.log("100"),t("handleNowValueChange",e.value[4]);break}},x=()=>{v.value=!v.value},T=()=>{o.value>1&&(o.value--,console.log("\u51CF"),a.value=0,e.value=Array.from(l.yearArr).slice((o.value-1)*s.value,o.value*s.value),t("handleNowValueChange",e.value[0]))},P=()=>{o.value<Math.ceil(l.yearArr.length/s.value)&&(o.value++,console.log("\u52A0"),a.value=0,e.value=Array.from(l.yearArr).slice((o.value-1)*s.value,o.value*s.value),t("handleNowValueChange",e.value[0]))};return V(()=>l.yearArr,(n,u)=>{console.log(n,u),e.value=Array.from(n).slice((o.value-1)*s.value,o.value*s.value),console.log(e.value)}),V(e,(n,u)=>{console.log(n,u);let g={};e.value.forEach((w,h)=>{g[h*25]=w}),console.log(g),b.value=g,m.value=(e.value.length-1)*25},{deep:!0}),V(v,(n,u)=>{n?f=setInterval(()=>{a.value<m.value?(a.value+=25,t("handleNowValueChange",e.value[Math.floor(a.value/25)])):(a.value=0,t("handleNowValueChange",e.value[Math.floor(a.value/25)]))},l.second):f&&clearInterval(f)}),M(()=>{console.log(l.nowValue,l.yearArr,l.bgcolor,l.second)}),(n,u)=>{const g=i("el-slider"),w=i("DArrowLeft"),h=i("el-icon"),y=i("el-tooltip"),S=i("VideoPause"),D=i("VideoPlay"),R=i("DArrowRight");return p(),E("div",{class:j(l.bgcolor=="light"?"TimeLine2-light":"TimeLine2-dark")},[N("div",J,[l.yearArr.length?(p(),k(g,{key:0,modelValue:_(a),"onUpdate:modelValue":u[0]||(u[0]=A=>U(a)?a.value=A:a=A),step:25,"show-stops":"","show-tooltip":!1,min:_(B),max:_(m),marks:b.value,onChange:z},null,8,["modelValue","min","max","marks"])):C("",!0)]),N("div",O,[c(y,{class:"box-item",effect:"light",content:"\u4E0A\u4E00\u9875",placement:"top"},{default:d(()=>[c(h,{color:l.bgcolor=="light"?"#4a0987":"white",size:"30px",onClick:T},{default:d(()=>[c(w)]),_:1},8,["color"])]),_:1}),c(y,{class:"box-item",effect:"light",content:"\u64AD\u653E/\u6682\u505C",placement:"top"},{default:d(()=>[_(v)?(p(),k(h,{key:0,color:l.bgcolor=="light"?"#4a0987":"white",size:"30px",onClick:x},{default:d(()=>[c(S)]),_:1},8,["color"])):C("",!0),_(v)?C("",!0):(p(),k(h,{key:1,color:l.bgcolor=="light"?"#4a0987":"white",size:"30px",onClick:x},{default:d(()=>[c(D)]),_:1},8,["color"]))]),_:1}),c(y,{class:"box-item",effect:"light",content:"\u4E0B\u4E00\u9875",placement:"top"},{default:d(()=>[c(h,{color:l.bgcolor=="light"?"#4a0987":"white",size:"30px",onClick:P},{default:d(()=>[c(R)]),_:1},8,["color"])]),_:1})])],2)}}},G=I(q,[["__scopeId","data-v-4a4c3008"]]);export{G as default};
|