feat: 修改header 下拉菜单超过10个显示滚动条,以及显示省略号放在后方

This commit is contained in:
zhangyu
2020-11-18 11:25:33 +08:00
parent cc818f67cc
commit ec29c52740
5 changed files with 45 additions and 16 deletions

View File

@@ -66,11 +66,13 @@
<template>
<el-menu-item v-if="assetData.length == 0" index="3-0"><div @click="createBox({type: 6})"><i class="nz-icon nz-icon-create-square header-dropdown-add"></i>&nbsp;&nbsp;{{$t("overall.createDatacenter")}}</div></el-menu-item>
<template v-else>
<el-scrollbar :style="{height:assetData.length>10?'360px':'auto'}">
<el-menu-item :index="'3-' + index" v-for="(item, index) in assetData" :key="index">
<div @mouseenter="hoverItemIndex = '3-' + index" @mouseleave="hoverItemIndex = ''" @click="jumpToAsset(item)" :class="{'menu-item-active': route == '/asset' && activeItemIndex == item.id}">
<span class="too-long-split" style="width: 130px;">{{item.name}}</span>
</div>
</el-menu-item>
</el-scrollbar>
</template>
</template>
</el-submenu>
@@ -82,12 +84,14 @@
<template>
<el-menu-item v-if="projectData.length == 0" index="2-0"><div @click="createBox({type: 1})"><i class="nz-icon nz-icon-create-square header-dropdown-add"></i>&nbsp;&nbsp;{{$t("overall.createProject")}}</div></el-menu-item>
<template v-else>
<el-scrollbar :style="{height:projectData.length>10?'360px':'auto'}">
<el-menu-item :index="'2-' + index" v-for="(item, index) in projectData" :key="index">
<div @mouseenter="hoverItemIndex = '2-' + index" @mouseleave="hoverItemIndex = ''" @click="jumpToProject(item)" :class="{'menu-item-active': route == '/project' && activeItemIndex == item.id}">
<span class="too-long-split" style="width: 135px;">{{item.name}}</span>
<div v-show="hoverItemIndex == '2-' + index && item.buildIn != 1" @click.stop="toEditProject(item)" class="menu-edit"><i class="nz-icon nz-icon-edit"></i></div>
</div>
</el-menu-item>
</el-scrollbar>
</template>
</template>
</el-submenu>
@@ -527,6 +531,16 @@
},
route() {
return this.$route.path;
},
overViewProject(){
return this.$store.getters.getOverViewProject;
}
},
watch:{
overViewProject(n){
if(n){
this.jumpToProject(n)
}
}
},
destroyed() {

View File

@@ -916,7 +916,10 @@ const cn = {
straight:'直线',
curve:'曲线',
upload:'上传文件',
requiredName:'名称不能为空'
requiredName:'名称不能为空',
imgFormat:'上传图片只能是 JPG/png 格式!',
imgSize:'上传图片大小不能超过 2MB!',
imgMeasure:'上传的图片宽高必须都大于100!',
},
},
date:{

View File

@@ -922,7 +922,10 @@ const en = {
straight:'straight',
curve:'curve',
upload:'upload',
requiredName:'The name of the required'
requiredName:'The name of the required',
imgFormat:'Upload picture can only be JPG/ PNG format!',
imgSize:'Upload image size should not exceed 2MB!',
imgMeasure:'The width and height of uploaded pictures must be greater than 100!',
},
},
date:{

View File

@@ -60,9 +60,11 @@
if(this.chartType==='ruleBar'){
this.option.yAxis.axisLabel.formatter=function(value) {
if (value.length > 12) {
return "..."+ value.substring(value.length-12, value.length);
return value.substring(0, 12) + "...";
}else{
return value
}
return value;
}
}
if(this.showToolbox == false){

View File

@@ -26,6 +26,7 @@ const store = new Vuex.Store({
searchName: ''
},
idcArr:[],
overViewProject:{},
},
getters: {
getLinkData(state){
@@ -40,6 +41,9 @@ const store = new Vuex.Store({
getIdcArr(state){
return state.idcArr
},
getOverViewProject(state){
return state.overViewProject
},
},
mutations: {
/* 监听对象变化,用于顶部菜单与底部内容的同步 */
@@ -104,7 +108,10 @@ const store = new Vuex.Store({
},
setCurrentDc(state,data){
state.currentDc = data
}
},
setOverViewProject(state,data){
state.overViewProject=data;
},
},
actions: {
}