新聞中心
本文小編為大家詳細(xì)介紹“vue怎么實(shí)現(xiàn)管理系統(tǒng)頂部tags瀏覽歷史”,內(nèi)容詳細(xì),步驟清晰,細(xì)節(jié)處理妥當(dāng),希望這篇“vue怎么實(shí)現(xiàn)管理系統(tǒng)頂部tags瀏覽歷史”文章能幫助大家解決疑惑,下面跟著小編的思路慢慢深入,一起來學(xué)習(xí)新知識吧。
網(wǎng)站的建設(shè)創(chuàng)新互聯(lián)公司專注網(wǎng)站定制,經(jīng)驗(yàn)豐富,不做模板,主營網(wǎng)站定制開發(fā).小程序定制開發(fā),H5頁面制作!給你煥然一新的設(shè)計(jì)體驗(yàn)!已為火鍋店設(shè)計(jì)等企業(yè)提供專業(yè)服務(wù)。
不用任何vuex,亂七八糟的方法,全在一個文件,粘貼即用
放到你想要的位置即可(此demo,放在了面包屑上面)
先安裝 (監(jiān)聽某dom元素大小的包)
npm install element-resize-detector
tags.vue
class="arrow arrow_left"
v-show="arrowVisible"
@click="handleClickToLeft"
>
v-for="(tag, index) in tags" :key="tag.name" :class="[active == index ? 'active top_tags' : 'top_tags']" effect="dark" :closable="tag.name != 'Firstpage1'" @close="handleClose(index, tag)" @click="clickTag(index, tag)" @contextmenu.native.prevent="handleClickContextMenu(index, tag)" > {{ $t("router." + tag.name) }}
class="arrow arrow_right"
v-show="arrowVisible"
@click="handleClickToRight"
>
v-if="this.active == this.contextMenu.index"
class="el-dropdown-menu__item"
@click="refresh"
>
刷新
v-show="contextMenu.isShow"
:style="{ left: contextMenu.menuLeft, top: '96px' }"
class="el-dropdown-menu el-popper"
x-placement="bottom-end"
>
/deep/.el-tag--dark {
border-color: transparent;
}
/deep/.el-tag--dark .el-tag__close {
color: #86909c;
font-size: 16px;
}
/deep/.el-tag--dark .el-tag__close:hover {
background: #e7eaf0;
}
.tags {
position: relative;
overflow: hidden;
.arrow {
width: 48px;
text-align: center;
cursor: pointer;
background: #fff;
position: absolute;
z-index: 1;
&_left {
left: 0;
top: 0;
}
&_right {
right: 0;
top: 0;
}
}
&_content {
transition: 0.3s;
white-space: nowrap;
// padding: 0 16px;
}
.top_tags {
margin-right: 8px;
cursor: pointer;
background: #fff;
font-size: 12px;
font-weight: 400;
color: #1d2129;
}
.top_tags:hover,
.active,
.arrow:hover {
background: #e7eaf0;
}
}
重點(diǎn)
需要修改的地方
currentPgae.name 是路由結(jié)構(gòu)的name,判斷有無存在,沒有就添加,有就定位到上面,根據(jù)項(xiàng)目修改
監(jiān)聽刷新時,去本地存儲 tags 和 當(dāng)前頁面的active,F(xiàn)tistpage1 改成自己的首頁即可
讀到這里,這篇“vue怎么實(shí)現(xiàn)管理系統(tǒng)頂部tags瀏覽歷史”文章已經(jīng)介紹完畢,想要掌握這篇文章的知識點(diǎn)還需要大家自己動手實(shí)踐使用過才能領(lǐng)會,如果想了解更多相關(guān)內(nèi)容的文章,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。
當(dāng)前標(biāo)題:vue怎么實(shí)現(xiàn)管理系統(tǒng)頂部tags瀏覽歷史
瀏覽地址:http://www.dlmjj.cn/article/jsidhe.html