new zt Time
This commit is contained in:
parent
4724df0238
commit
d177814444
@ -5,13 +5,14 @@ let route = useRoute()
|
||||
// const handleSelect = (key: string, keyPath: string[]) => {
|
||||
// console.log(key, keyPath)
|
||||
// }
|
||||
const dataLoading = ref<boolean>(true)
|
||||
const dataLoading = ref<boolean>(false)
|
||||
const HotArray = ref([])
|
||||
$fetch("https://data.zziyu.cn/hot/webs").then(data=>{
|
||||
HotArray.value=data as any
|
||||
dataLoading.value=false
|
||||
})
|
||||
// $fetch("https://data.zziyu.cn/hot/webs").then(data=>{
|
||||
// HotArray.value=data as any
|
||||
// dataLoading.value=false
|
||||
// })
|
||||
// console.log(HotArray)
|
||||
// dataLoading.value=true
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -2304,7 +2304,7 @@
|
||||
},
|
||||
"node_modules/@parcel/watcher-wasm/node_modules/napi-wasm": {
|
||||
"version": "1.1.0",
|
||||
"dev": true,
|
||||
"extraneous": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
|
@ -3,10 +3,27 @@ const showTime = ref<Date>(new Date())
|
||||
// const testDate = new Date()
|
||||
// testDate.setHours(24)
|
||||
// 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 = ()=>{
|
||||
console.log("正在更新时间")
|
||||
showTime.value = new Date()
|
||||
|
||||
toZkTime.value = getToZkTime()
|
||||
}
|
||||
let st: string | number | NodeJS.Timeout | undefined
|
||||
onMounted(()=>{
|
||||
@ -30,6 +47,9 @@ onBeforeUnmount(()=>{
|
||||
<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>
|
||||
</div>
|
||||
<div>
|
||||
<el-text style="font-size: 2vw">距离中考还有 {{toZkTime}}</el-text>
|
||||
</div>
|
||||
</client-only>
|
||||
</template>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user