new zt Time

This commit is contained in:
ZtRXR 2024-03-09 09:46:00 +08:00
parent 4724df0238
commit d177814444
3 changed files with 28 additions and 7 deletions

View File

@ -5,13 +5,14 @@ let route = useRoute()
// const handleSelect = (key: string, keyPath: string[]) => { // const handleSelect = (key: string, keyPath: string[]) => {
// console.log(key, keyPath) // console.log(key, keyPath)
// } // }
const dataLoading = ref<boolean>(true) const dataLoading = ref<boolean>(false)
const HotArray = ref([]) const HotArray = ref([])
$fetch("https://data.zziyu.cn/hot/webs").then(data=>{ // $fetch("https://data.zziyu.cn/hot/webs").then(data=>{
HotArray.value=data as any // HotArray.value=data as any
dataLoading.value=false // dataLoading.value=false
}) // })
// console.log(HotArray) // console.log(HotArray)
// dataLoading.value=true
</script> </script>
<template> <template>

2
package-lock.json generated
View File

@ -2304,7 +2304,7 @@
}, },
"node_modules/@parcel/watcher-wasm/node_modules/napi-wasm": { "node_modules/@parcel/watcher-wasm/node_modules/napi-wasm": {
"version": "1.1.0", "version": "1.1.0",
"dev": true, "extraneous": true,
"inBundle": true, "inBundle": true,
"license": "MIT" "license": "MIT"
}, },

View File

@ -3,10 +3,27 @@ const showTime = ref<Date>(new Date())
// const testDate = new Date() // const testDate = new Date()
// testDate.setHours(24) // testDate.setHours(24)
// const showTime = ref<Date>(testDate) // const showTime = ref<Date>(testDate)
const zkTime = new Date("2024-06-26 09:00:00")
var nowDate =new Date()
const toZkTime = ref<string>("")
const getToZkTime = ()=>{
nowDate = new Date()
var subtime = (zkTime - nowDate) / 1000; //,
var days = parseInt(subtime / 86400); // 24*60*60*1000
var hours = parseInt(subtime / 3600) - 24 * days; // 60*60 -=
var mins = parseInt(subtime % 3600 / 60); // - (day*24) 60 /60
var secs = parseInt(subtime % 60); //60
return days + "天 " + hours + "小时 " + mins + "分钟 ";
}
const renewTime = ()=>{ const renewTime = ()=>{
console.log("正在更新时间") console.log("正在更新时间")
showTime.value = new Date() showTime.value = new Date()
toZkTime.value = getToZkTime()
} }
let st: string | number | NodeJS.Timeout | undefined let st: string | number | NodeJS.Timeout | undefined
onMounted(()=>{ onMounted(()=>{
@ -30,6 +47,9 @@ onBeforeUnmount(()=>{
<el-text style="font-size: 5vw">:</el-text> <el-text style="font-size: 5vw">:</el-text>
<el-text style="font-size: 5vw">{{(showTime.getSeconds())/10<1?`0${showTime.getSeconds()}`:showTime.getSeconds()}}</el-text> <el-text style="font-size: 5vw">{{(showTime.getSeconds())/10<1?`0${showTime.getSeconds()}`:showTime.getSeconds()}}</el-text>
</div> </div>
<div>
<el-text style="font-size: 2vw">距离中考还有 {{toZkTime}}</el-text>
</div>
</client-only> </client-only>
</template> </template>