ly-front/src/views/contentData/headerTop/index.vue

80 lines
1.6 KiB
Vue
Raw Normal View History

2025-03-31 15:26:29 +00:00
<template>
<div class="header">
<div class="header-left">
2025-06-18 15:08:37 +00:00
<!-- <div class="header-logo"></div> -->
<div class="time_date">
{{ currentDate }} <span>{{ currentTime }}</span>
</div>
2025-03-31 15:26:29 +00:00
</div>
<div class="header-main">
<div class="textTile">
2025-06-18 15:08:37 +00:00
<!-- <img src="@/assets/img/title.svg" alt="" /> -->
2025-03-31 15:26:29 +00:00
</div>
</div>
2025-06-19 15:41:07 +00:00
<div class="header-menu">
<span>{{ leftText }}</span>
<span style="width: 20px"> | </span>
<span>{{ rightText }}</span>
</div>
2025-03-31 15:26:29 +00:00
</div>
</template>
<script>
export default {
name: "header-top",
2025-06-19 15:41:07 +00:00
components: {},
2025-03-31 15:26:29 +00:00
props: {
homeData: {
type: Object,
default: () => ({})
}
},
data() {
return {
currentTime: "",
currentDate: "",
currentDialog: "",
fromItem: {},
2025-06-19 15:41:07 +00:00
isAdmins: false,
leftText: "平台已连接",
rightText: "定位正常"
2025-03-31 15:26:29 +00:00
};
},
2025-04-02 14:51:32 +00:00
created() {},
2025-03-31 15:26:29 +00:00
watch: {
homeData: {
2025-06-19 15:41:07 +00:00
handler(newVal) {},
2025-03-31 15:26:29 +00:00
deep: true
}
},
mounted() {
2025-04-02 14:51:32 +00:00
this.isAdmins = JSON.parse(localStorage.getItem("isAdmin"));
2025-03-31 15:26:29 +00:00
this.updateTime();
setInterval(this.updateTime, 1000); // 每秒更新一次时间
},
methods: {
updateTime() {
const now = new Date();
this.currentTime = now.toLocaleTimeString(); // 获取当前时间,格式为本地时间格式
this.currentDate = now.toLocaleDateString(); // 获取当前日期,格式为本地日期格式
}
}
};
</script>
<style scoped>
.logo {
font-size: 20px;
font-weight: bold;
}
.time {
font-size: 14px;
}
.actions span {
margin-left: 10px;
cursor: pointer;
}
</style>