css畫一個帶左側(cè)剪頭的氣泡卡

在el-submenux寫一個懸浮框氣泡卡展示圖標標題,方案:利用三角形錯位,營造一個假三角形錯覺。。


1、html index為上一級傳入的prop index,是每一級導航的索引值

<el-submenu v-else ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body :class="['menu-level-' + level]">

? ? ? <template slot="title">

? ? ? ? <item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />

<!--? ? ? ? 懸浮氣泡彈框-->

? ? ? ? <div class="pop-content-title" :style="{top: (105+40*index) + 'px'}">{{item.meta.title}}

? ? ? ? <div class="pop-content-title-triangle" :style="{top: (114+40*index) + 'px'}">


? ? ? ? v-for="child in item.children"

? ? ? ? :key="child.path"

? ? ? ? :is-nest="true"

? ? ? ? :item="child"

? ? ? ? :base-path="resolvePath(child.path)"

? ? ? ? class="nest-menu"

? ? ? ? :level="level + 1"

? ? ? />

? ? </el-submenu>


2、css

.hideSidebar .el-submenu:hover .pop-content-title{

? position:fixed;

? left:128px;

? width:90px;

? height:32px;

? line-height:32px;

? background-color:#fff;

? color:#242424;

? border:1px solid var(--Stroke-Light-Base, #E5E5E7);

? border-radius:5px;

}

.hideSidebar .el-submenu:hover? .pop-content-title-triangle{

? position:fixed;

? left:120px;

? width:0;

? height:0;

? border-top:7px solid transparent;

? border-bottom:7px solid transparent;

? border-right:9px solid var(--Stroke-Light-Base, #E5E5E7);

}

.hideSidebar .el-submenu:hover .pop-content-title-triangle::before{

? position:absolute;

? content:"";

? left:1px;

? top:-7px;

? width:0;

? height:0;

? border-top:7px solid transparent;

? border-bottom:7px solid transparent;

? border-right:9px solid #fff;

}


3、效果圖如下:


?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容