UNPKG

t-fighting-design

Version:

Fighting design can quickly build interactive interfaces in vue3 applications, which looks good.

2 lines (1 loc) 1.27 kB
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),o=require("../../_utils/index8.js"),y=require("../../_utils/index9.js"),f=(u,e)=>{const c=n.ref(new Date(`${u.value}/${e.value+1}/1`).getDay()),v=new y.Lunar;n.watch(()=>e.value,a=>{c.value=new Date(`${u.value}/${a+1}/1`).getDay()});const r=n.computed(()=>{let a=o.getDayMonth(u.value,e.value-1);const l=[];for(let t=0;t<c.value;t++){const s=v.getLunarDetail(u.value,e.value,a);s!==-1?l.push(s):l.push({cDay:a,cMonth:e.value}),a--}return l.reverse()}),D=n.computed(()=>{const a=o.getDayMonth(u.value,e.value)+c.value,l=a%7===0?0:7-a%7;if(!l)return[];const t=[];for(let s=0;s<l;s++){const i=v.getLunarDetail(u.value,e.value+2,s+1);i!==-1?t.push(i):t.push({cDay:s+1,cMonth:e.value+2})}return t}),M=n.computed(()=>{const a=o.getDayMonth(u.value,e.value),l=[];for(let t=0;t<a;t++){const s=v.getLunarDetail(u.value,e.value+1,t+1);s!==-1?l.push(s):l.push({cDay:t+1,cMonth:e.value+1})}return l}),d=()=>{if(e.value>0){e.value--;return}u.value--,e.value=11},h=()=>{if(e.value<11){e.value++;return}u.value++,e.value=0};return{AllMonthDays:n.computed(()=>[...r.value,...M.value,...D.value]),changeLastMonth:d,changeNextMonth:h}};exports.useCalculiTime=f;