summaryrefslogtreecommitdiff
path: root/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar
diff options
context:
space:
mode:
authorunknown <[email protected]>2022-06-24 17:11:23 +0800
committerunknown <[email protected]>2022-06-24 17:11:23 +0800
commit8565e1bb597b481447d33bac6d8c48c2c45215de (patch)
treea4f10c8f7f85a1a8b5c947f7d0d2f967d808a9c4 /UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar
parent8165dfcc7bdb0b2e6f1c05f8e7c93553c0e7911e (diff)
upload UI source codeHEADmain
Diffstat (limited to 'UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar')
-rw-r--r--UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/FixiOSBug.js26
-rw-r--r--UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/Item.vue29
-rw-r--r--UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/Link.vue36
-rw-r--r--UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/Logo.vue44
-rw-r--r--UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/SidebarItem.vue105
-rw-r--r--UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/index.vue90
6 files changed, 330 insertions, 0 deletions
diff --git a/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/FixiOSBug.js b/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/FixiOSBug.js
new file mode 100644
index 0000000..bc14856
--- /dev/null
+++ b/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/FixiOSBug.js
@@ -0,0 +1,26 @@
+export default {
+ computed: {
+ device() {
+ return this.$store.state.app.device
+ }
+ },
+ mounted() {
+ // In order to fix the click on menu on the ios device will trigger the mouseleave bug
+ // https://github.com/PanJiaChen/vue-element-admin/issues/1135
+ this.fixBugIniOS()
+ },
+ methods: {
+ fixBugIniOS() {
+ const $subMenu = this.$refs.subMenu
+ if ($subMenu) {
+ const handleMouseleave = $subMenu.handleMouseleave
+ $subMenu.handleMouseleave = (e) => {
+ if (this.device === 'mobile') {
+ return
+ }
+ handleMouseleave(e)
+ }
+ }
+ }
+ }
+}
diff --git a/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/Item.vue b/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/Item.vue
new file mode 100644
index 0000000..b515f61
--- /dev/null
+++ b/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/Item.vue
@@ -0,0 +1,29 @@
+<script>
+export default {
+ name: 'MenuItem',
+ functional: true,
+ props: {
+ icon: {
+ type: String,
+ default: ''
+ },
+ title: {
+ type: String,
+ default: ''
+ }
+ },
+ render(h, context) {
+ const { icon, title } = context.props
+ const vnodes = []
+
+ if (icon) {
+ vnodes.push(<svg-icon icon-class={icon}/>)
+ }
+
+ if (title) {
+ vnodes.push(<span slot='title'>{(title)}</span>)
+ }
+ return vnodes
+ }
+}
+</script>
diff --git a/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/Link.vue b/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/Link.vue
new file mode 100644
index 0000000..eb4dd10
--- /dev/null
+++ b/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/Link.vue
@@ -0,0 +1,36 @@
+
+<template>
+ <!-- eslint-disable vue/require-component-is -->
+ <component v-bind="linkProps(to)">
+ <slot />
+ </component>
+</template>
+
+<script>
+import { isExternal } from '@/utils/validate'
+
+export default {
+ props: {
+ to: {
+ type: String,
+ required: true
+ }
+ },
+ methods: {
+ linkProps(url) {
+ if (isExternal(url)) {
+ return {
+ is: 'a',
+ href: url,
+ target: '_blank',
+ rel: 'noopener'
+ }
+ }
+ return {
+ is: 'router-link',
+ to: url
+ }
+ }
+ }
+}
+</script>
diff --git a/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/Logo.vue b/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/Logo.vue
new file mode 100644
index 0000000..e50a338
--- /dev/null
+++ b/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/Logo.vue
@@ -0,0 +1,44 @@
+<template>
+ <div class="log">
+ <img :src="logo" alt="">
+ <p>DiamondV</p>
+ </div>
+</template>
+
+<script>
+import Logo from '@/assets/images/newlogo.png'
+export default {
+ data() {
+ return {
+ logo: Logo
+ }
+ }
+}
+</script>
+
+<style lang="scss" scoped>
+
+.log{
+ width: 13%;
+ height: 56px;
+ background-color: #4608ad;
+ color: white;
+ text-align: center;
+ display: flex;
+ justify-content:center;
+ align-items: center;
+ font-size: 25px;
+ font-weight: 600;
+ p{
+ font-family:"仿宋";
+ font-style:italic;
+ font-size: 20px;
+ }
+ img{
+ margin-right: 18px;
+ width: 50px;
+ height: 55px;
+ }
+}
+
+</style>
diff --git a/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/SidebarItem.vue b/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/SidebarItem.vue
new file mode 100644
index 0000000..b4d2911
--- /dev/null
+++ b/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/SidebarItem.vue
@@ -0,0 +1,105 @@
+<template>
+ <!-- <div v-if="!item.hidden">-->
+ <!-- todo 增加了style样式 style="display:inline-block;"-->
+ <div v-if="!item.hidden" style="display:inline-block;">
+ <template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
+ <app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
+ <el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
+ <item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" />
+ </el-menu-item>
+ </app-link>
+ </template>
+
+ <el-submenu v-else ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body>
+ <template slot="title">
+ <item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />
+ <!--todo 增加div固定宽度,用于菜单上的小箭头显示-->
+ <div style="display: inline-block; width:20px;" />
+ </template>
+ <sidebar-item
+ v-for="child in item.children"
+ :key="child.path"
+ :is-nest="true"
+ :item="child"
+ :base-path="resolvePath(child.path)"
+ class="nest-menu"
+ />
+ </el-submenu>
+ </div>
+</template>
+
+<script>
+import path from 'path'
+import { isExternal } from '@/utils/validate'
+import Item from './Item'
+import AppLink from './Link'
+import FixiOSBug from './FixiOSBug'
+
+export default {
+ name: 'SidebarItem',
+ components: { Item, AppLink },
+ mixins: [FixiOSBug],
+ props: {
+ // route object
+ item: {
+ type: Object,
+ required: true
+ },
+ isNest: {
+ type: Boolean,
+ default: false
+ },
+ basePath: {
+ type: String,
+ default: ''
+ }
+ },
+ data() {
+ // To fix https://github.com/PanJiaChen/vue-admin-template/issues/237
+ // TODO: refactor with render function
+ this.onlyOneChild = null
+ return {}
+ },
+ methods: {
+ hasOneShowingChild(children = [], parent) {
+ const showingChildren = children.filter(item => {
+ if (item.hidden) {
+ return false
+ } else {
+ // Temp set(will be used if only has one showing child)
+ this.onlyOneChild = item
+ return true
+ }
+ })
+
+ // When there is only one child router, the child router is displayed by default
+ if (showingChildren.length === 1) {
+ return true
+ }
+
+ // Show parent if there are no child router to display
+ if (showingChildren.length === 0) {
+ this.onlyOneChild = { ... parent, path: '', noShowingChildren: true }
+ return true
+ }
+
+ return false
+ },
+ resolvePath(routePath) {
+ if (isExternal(routePath)) {
+ return routePath
+ }
+ if (isExternal(this.basePath)) {
+ return this.basePath
+ }
+ return path.resolve(this.basePath, routePath)
+ }
+ }
+}
+</script>
+<style scoped>
+.el-menu-item {
+ font-size: 17px;
+ color: white !important;
+}
+</style> \ No newline at end of file
diff --git a/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/index.vue b/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/index.vue
new file mode 100644
index 0000000..1076b36
--- /dev/null
+++ b/UI source code/dns_mapping_ui-master/src/layout/components/HeadNavbar/index.vue
@@ -0,0 +1,90 @@
+<template>
+ <!-- <div :class="{'has-logo':showLogo}" > -->
+ <div class="menu">
+ <!--TODO 文章中删除了logo,有验证了一次,可以不删除-->
+ <!-- <logo v-if="showLogo" :collapse="isCollapse"/> -->
+ <Logo />
+ <el-scrollbar id="navlist" wrap-class="scrollbar-wrapper">
+ <!--TODO 将el-menu标签下的mode属性更改为horizontal-->
+ <!-- <span>1111</span> -->
+ <el-menu
+ :default-active="activeMenu"
+ :collapse="isCollapse"
+ :background-color="variables.menuBg"
+ :text-color="variables.menuText"
+ :unique-opened="false"
+ :active-text-color="variables.menuActiveText"
+ :collapse-transition="false"
+ mode="horizontal"
+ >
+ <sidebar-item v-for="route in sidebarRouters" :key="route.path" :item="route" :base-path="route.path" />
+ </el-menu>
+ </el-scrollbar>
+ <navbar />
+ </div>
+</template>
+
+<script>
+import { mapGetters } from 'vuex'
+import SidebarItem from './SidebarItem'
+import variables from '@/assets/styles/variables.scss'
+import Navbar from '../Navbar.vue'
+import Logo from './Logo.vue'
+
+export default {
+ // components: {Logo },
+ components: { SidebarItem, Navbar, Logo },
+ computed: {
+ ...mapGetters([
+ 'sidebarRouters',
+ 'sidebar'
+ ]),
+ activeMenu() {
+ const route = this.$route
+ const { meta, path } = route
+ // if set path, the sidebar will highlight the path you set
+ if (meta.activeMenu) {
+ return meta.activeMenu
+ }
+ return path
+ },
+ showLogo() {
+ return this.$store.state.settings.sidebarLogo
+ },
+ variables() {
+ return variables
+ },
+ isCollapse() {
+ return !this.sidebar.opened
+ }
+ }
+}
+</script>
+<style lang="scss" scoped>
+.menu{
+ display: flex;
+}
+#navlist {
+width: 80% !important;
+float: left;
+}
+
+ #navlist >>> .el-submenu__title {
+ font-weight: 100;
+ font-size:18px !important;
+ color: white !important;
+ }
+ #navlist >>> .is-active{
+ font-size: 18px !important;
+ font-weight: 600 !important;
+ background-color: rgb(50, 4, 122) !important;
+ }
+ #navlist >>> .el-scrollbar__wrap{
+ margin-bottom: 0px;
+ overflow: hidden;
+ }
+/* .el-scrollbar__view{
+ display: flex;
+} */
+
+</style>