-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from terwer/dev
feat:#1 完善菜单与底部
- Loading branch information
Showing
17 changed files
with
1,512 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<template> | ||
<client-only> | ||
<el-menu | ||
:default-active="activeIndex" | ||
class="el-menu-demo" | ||
mode="horizontal" | ||
@select="handleSelect" | ||
> | ||
<template v-for="item in menuData.menuList"> | ||
<el-sub-menu | ||
v-if="item.children && item.children.length > 0" | ||
:key="item.id" | ||
:index="item.link" | ||
> | ||
<template #title> | ||
<font-awesome-icon :icon="item.icon || ''"/> | ||
{{ item.name }} | ||
</template> | ||
<el-menu-item | ||
v-for="child in item.children" | ||
:key="child.id" | ||
:index="item.link + child.link" | ||
> | ||
<nuxt-link :to="item.link + child.link"> | ||
<font-awesome-icon :icon="child.icon || ''"/> | ||
{{ child.name }} | ||
</nuxt-link> | ||
</el-menu-item> | ||
</el-sub-menu> | ||
<el-menu-item v-else :key="item.id" :index="item.link"> | ||
<div> | ||
<nuxt-link :to="item.link"> | ||
<font-awesome-icon :icon="item.icon || ''"/> | ||
{{ item.name }} | ||
</nuxt-link> | ||
</div> | ||
</el-menu-item> | ||
</template> | ||
</el-menu> | ||
</client-only> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import {ElMenu, ElMenuItem, ElSubMenu} from "element-plus"; | ||
import {ref} from 'vue' | ||
import logUtil from "~/lib/logUtil"; | ||
const router = useRouter(); | ||
const activeIndex = ref('/') | ||
const menuData = ref({ | ||
menuList: [ | ||
{ | ||
id: 1, | ||
name: "首页", | ||
link: "/", | ||
icon: "fa-home" | ||
}, | ||
{ | ||
id: 2, | ||
name: "文章", | ||
link: "/", | ||
icon: "fa-book", | ||
children: [ | ||
{ | ||
id: 21, | ||
name: "后端开发", | ||
link: "/backend", | ||
icon: "fa-jar" | ||
} | ||
] | ||
}, | ||
{ | ||
id: 4, | ||
name: "随笔", | ||
link: "/essay", | ||
icon: "fa-bolt" | ||
}, | ||
{ | ||
id: 5, | ||
name: "关于", | ||
link: "/about", | ||
icon: "fa-user" | ||
}, | ||
{ | ||
id: 5, | ||
name: "设置", | ||
link: "/setting", | ||
icon: "fa-gear" | ||
} | ||
] | ||
}) | ||
const handleSelect = (key: string, keyPath: string[]) => { | ||
logUtil.logInfo("go=>", key) | ||
router.push({path: key}); | ||
} | ||
</script> | ||
|
||
<script lang="ts"> | ||
export default { | ||
name: "HeaderMenu", | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.el-menu-item a svg { | ||
vertical-align: middle; | ||
margin-top: -4px; | ||
} | ||
.el-sub-menu svg { | ||
vertical-align: middle; | ||
padding-right: 5px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<template> | ||
<el-row class="time"> | ||
<el-col :xs="24" :sm="24" :md="8"> | ||
<div> | ||
现在是 | ||
<client-only> | ||
{{ timeData.clientTime }} | ||
</client-only> | ||
{{ timeData.weekday }} | ||
</div> | ||
</el-col> | ||
<el-col :xs="24" :sm="24" :md="8"> | ||
<div>{{ timeData.popTime === "" ? "加载中..." : timeData.popTime }}</div> | ||
</el-col> | ||
<el-col :xs="24" :sm="24" :md="8"> | ||
<div>{{ timeData.tradTime === "" ? "加载中..." : timeData.tradTime }}</div> | ||
</el-col> | ||
</el-row> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import {ElCol, ElRow} from "element-plus"; | ||
import { | ||
getClientTime, getWeekByDay, | ||
getPopTime, | ||
getShengXiao, | ||
getTradTime | ||
} from "~/lib/DateUtil"; | ||
import {onMounted} from "vue"; | ||
import {inBrowser} from "~/lib/util"; | ||
const timeData = ref({ | ||
clientTime: "", | ||
weekday: "", | ||
popTime: "", | ||
tradTime: "", | ||
shengxiao: "" | ||
}) | ||
const initData = () => { | ||
timeData.value.clientTime = getClientTime() | ||
timeData.value.weekday = getWeekByDay(); | ||
timeData.value.popTime = getPopTime(); | ||
timeData.value.tradTime = getTradTime(); | ||
timeData.value.shengxiao = getShengXiao(); | ||
} | ||
initData(); | ||
onMounted(() => { | ||
if (inBrowser()) { | ||
setInterval(function () { | ||
timeData.value.clientTime = getClientTime(); | ||
}, 1000); | ||
} | ||
}) | ||
</script> | ||
|
||
<script lang="ts"> | ||
export default { | ||
name: "HeaderTime" | ||
} | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.time{ | ||
margin-bottom: 10px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
<template> | ||
<div> | ||
Data begin | ||
{{ data }} | ||
Data end | ||
{{ data.msg }} | ||
|
||
<h1> | ||
<NuxtLink to="/post"> | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
342645c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
jvue-front – ./
jvue-front.vercel.app
jvue-front-git-main-terwergreen.vercel.app
www.terwer.space
jvue-front-terwergreen.vercel.app
terwer.space