前端联调接口

This commit is contained in:
陈淳
2022-10-11 16:48:25 +08:00
parent 58f85992b0
commit a0c869d0a1
54 changed files with 899 additions and 137 deletions

View File

@@ -0,0 +1,37 @@
<template>
<span class="subtitle">{{ showTime }}</span>
</template>
<style scoped>
</style>
<script setup lang="ts">
import { ref, computed } from "vue";
const props = defineProps<{ time: string }>();
const showTime = computed(() => {
var dataTime=new Date(Date.parse(props.time));
const hour:number= getHour(dataTime,new Date())
if(hour<=0)
{
return "刚刚"
}
if(hour<=6)
{
return hour+"小时前"
}
return props.time;
});
const getHour=(s1:Date, s2:Date)=> {
var ms = s2.getTime() - s1.getTime();
if (ms < 0) return 0;
return Math.floor(ms / 1000 / 60 / 60); //小时
}
</script>
<style scoped>
.subtitle{
color: #CBCBCB;
}
</style>