|
@@ -0,0 +1,144 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div class="menu-container">
|
|
|
|
|
+ <div class="menu-logo">
|
|
|
|
|
+ LOGO
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="project-switcher" v-show="projectList.length>0" ref="switcher">
|
|
|
|
|
+ <div class="selected-project-name">{{selectedProject.name}}</div>
|
|
|
|
|
+ <div class="icon" @click="handleSwitcherClick"></div>
|
|
|
|
|
+ <transition name="expand">
|
|
|
|
|
+ <div class="dropdown" v-show="isDropDownExpand">
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-for="item in projectList"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ class="item"
|
|
|
|
|
+ @click="handleProjectChange(item)">{{item.name}}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </transition>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="notify"></div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script>
|
|
|
|
|
+export default {
|
|
|
|
|
+ name: 'Menu',
|
|
|
|
|
+ props: {
|
|
|
|
|
+ projectList: Array,
|
|
|
|
|
+ selectedProject: Object,
|
|
|
|
|
+ },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ isDropDownExpand: false,
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ mounted() {
|
|
|
|
|
+ document.addEventListener('click', (e) => {
|
|
|
|
|
+ if (!this.$refs.switcher.contains(e.target)) {
|
|
|
|
|
+ this.isDropDownExpand = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ handleSwitcherClick() {
|
|
|
|
|
+ this.isDropDownExpand = !this.isDropDownExpand;
|
|
|
|
|
+ },
|
|
|
|
|
+ handleProjectChange(item) {
|
|
|
|
|
+ this.$emit('project-change', item.id);
|
|
|
|
|
+ this.isDropDownExpand = !this.isDropDownExpand;
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+};
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style scoped>
|
|
|
|
|
+.menu-container{
|
|
|
|
|
+ height: 58px;
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ position: fixed;
|
|
|
|
|
+ top:0px;
|
|
|
|
|
+ background-color: #34495E;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-direction: row;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: start;
|
|
|
|
|
+}
|
|
|
|
|
+.menu-logo{
|
|
|
|
|
+ color: #FFFFFF;
|
|
|
|
|
+ font-size: 24px;
|
|
|
|
|
+ font-weight: bolder;
|
|
|
|
|
+ line-height: 58px;
|
|
|
|
|
+ margin-left: 30px;
|
|
|
|
|
+ transition: all .2s linear;
|
|
|
|
|
+}
|
|
|
|
|
+.menu-logo:hover{
|
|
|
|
|
+ color: #BDC3C7;
|
|
|
|
|
+}
|
|
|
|
|
+.project-switcher{
|
|
|
|
|
+ margin-left: 20px;
|
|
|
|
|
+ background-color: #2C3E50;
|
|
|
|
|
+ height: 30px;
|
|
|
|
|
+ padding: 5px;
|
|
|
|
|
+ width: 240px;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-direction: row;
|
|
|
|
|
+ justify-content: start;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ border-radius: 5px;
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+}
|
|
|
|
|
+.project-switcher .icon{
|
|
|
|
|
+ width: 24px;
|
|
|
|
|
+ height: 24px;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ margin-left: auto;
|
|
|
|
|
+ background-position: center;
|
|
|
|
|
+ background-repeat: no-repeat;
|
|
|
|
|
+ background-size: 100% 100%;
|
|
|
|
|
+ transition: all .2s linear;
|
|
|
|
|
+ background-image: url("../assets/icon/menu.svg");
|
|
|
|
|
+}
|
|
|
|
|
+.project-switcher .icon:hover{
|
|
|
|
|
+ background-image: url("../assets/icon/menu-hover.svg");
|
|
|
|
|
+}
|
|
|
|
|
+.project-switcher .dropdown{
|
|
|
|
|
+ width: 240px;
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ background-color: #2C3E50;
|
|
|
|
|
+ color: #FFFFFF;
|
|
|
|
|
+ top: 39px;
|
|
|
|
|
+ left: 0px;
|
|
|
|
|
+ padding: 5px;
|
|
|
|
|
+ border-radius: 0 0 5px 5px;
|
|
|
|
|
+ flex-direction: column;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ align-items: start;
|
|
|
|
|
+ transform-origin: 0px 0px;
|
|
|
|
|
+}
|
|
|
|
|
+.expand-enter-active,.expand-leave-active{
|
|
|
|
|
+ transition: all .3s ease-in-out;
|
|
|
|
|
+}
|
|
|
|
|
+.expand-enter-from,.expand-leave-to{
|
|
|
|
|
+ opacity: 0;
|
|
|
|
|
+ transform: scaleY(0);
|
|
|
|
|
+}
|
|
|
|
|
+.project-switcher .selected-project-name{
|
|
|
|
|
+ width: 220px;
|
|
|
|
|
+ line-height: 30px;
|
|
|
|
|
+ color: #FFFFFF;
|
|
|
|
|
+ text-align: start;
|
|
|
|
|
+ text-overflow: ellipsis;
|
|
|
|
|
+ white-space:nowrap; overflow:hidden
|
|
|
|
|
+}
|
|
|
|
|
+.project-switcher .dropdown .item{
|
|
|
|
|
+ line-height: 24px;
|
|
|
|
|
+ width: 240px;
|
|
|
|
|
+ text-align: start;
|
|
|
|
|
+ text-overflow: ellipsis;
|
|
|
|
|
+ white-space:nowrap; overflow:hidden;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+}
|
|
|
|
|
+.project-switcher .dropdown .item:hover{
|
|
|
|
|
+ background-color: #34495E;
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|