vue移動(dòng)端時(shí)彈出側(cè)邊抽屜菜單效果
效果圖:

aside.vue:
<template>
<div class="aside">
<div
style="
height: 60px;
background-color: #2e6baa;
line-height: 60px;
display: flex;
align-items: center;
justify-content: center;
"
>
<img
src="https://lj-common.oss-cn-chengdu.aliyuncs.com/vue.png"
style="width: 30px; height: 30px"
/>
<span
style="
font-size: 20px;
font-weight: 600;
color: white;
margin-left: 10px;
"
>xxx平臺(tái)</span
>
</div>
<perfect-scrollbar>
<el-menu
:default-active="$route.path"
class="el-menu-vertical-demo"
background-color="#017BC4"
text-color="white"
active-text-color="white"
>
<el-menu-item index="/page1" @click="$router.push({ path: '/page1' })">
<el-image
src="https://lj-common.oss-cn-chengdu.aliyuncs.com/vue.png"
style="width: 30px; height: 30px; margin-right: 5px"
></el-image>
<span slot="title">page1</span> </el-menu-item
><el-menu-item index="/page2" @click="$router.push({ path: '/page2' })">
<el-image
src="https://lj-common.oss-cn-chengdu.aliyuncs.com/vue.png"
style="width: 30px; height: 30px; margin-right: 5px"
></el-image>
<span slot="title">page2</span>
</el-menu-item>
</el-menu>
</perfect-scrollbar>
</div>
</template>
<script>
export default {
data() {
return {};
},
created() {},
computed: {},
methods: {},
};
</script>
<style lang='scss' scoped>
.aside {
height: 100vh;
.ps {
height: calc(100vh - 60px);
//展開時(shí)寬度
.el-menu-vertical-demo:not(.el-menu--collapse) {
width: 256px;
}
.el-menu {
height: 100%;
border: 0 !important; //垂直時(shí),去除右側(cè)白邊
}
//item激活時(shí)的樣式
.el-menu-item.is-active {
background-color: #1890ff !important;
border-bottom: 0 !important;
}
}
}
</style>控制抽屜顯隱:
<el-drawer
:visible.sync="drawer"
direction="ltr"
:with-header="false"
:size="256"
>
<vAside></vAside>
</el-drawer><i class="el-icon-s-unfold hidden-sm-and-up" @click="collapseChange"></i>
<script>
import vAside from "./aside.vue";
export default {
name: "home",
components: { vAside },
props: {},
data() {
return {
drawer: false,
};
},
methods: {
// 切換折疊狀態(tài)
collapseChange() {
this.drawer = !this.drawer;
},
},
};
</script>由于上面使用了hidden-sm-and-up樣式,該樣式需要在main.js中引入display.css,如下:
import 'element-ui/lib/theme-chalk/display.css';
更多樣式參考:
Vue中使用vue2-perfect-scrollbar制作滾動(dòng)條
element-ui 實(shí)現(xiàn)響應(yīng)式導(dǎo)航欄的示例代碼
到此這篇關(guān)于vue移動(dòng)端時(shí)彈出側(cè)邊抽屜菜單的文章就介紹到這了,更多相關(guān)vue彈出側(cè)邊抽屜菜單內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
vue實(shí)現(xiàn)Excel文件的上傳與下載功能的兩種方式
這篇文章主要介紹了vue實(shí)現(xiàn)Excel文件的上傳與下載功能,本文通過兩種方式給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-06-06
Vue $mount實(shí)戰(zhàn)之實(shí)現(xiàn)消息彈窗組件
這篇文章主要介紹了Vue $mount實(shí)現(xiàn)消息彈窗組件的相關(guān)知識(shí),非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-04-04
Vue中實(shí)現(xiàn)動(dòng)畫效果的多種方法小結(jié)
平時(shí)我們能在網(wǎng)頁上看到很多動(dòng)畫效果,這些效果看起來就很引人注目,我們是不是也可以在自己的項(xiàng)目中添加一些動(dòng)畫效果,讓我們的頁面看起來更加的高端大氣上檔次,博人眼球,所以本文給大家介紹了Vue中實(shí)現(xiàn)動(dòng)畫效果的多種方法,需要的朋友可以參考下2024-07-07
Vue2學(xué)習(xí)筆記之請(qǐng)求數(shù)據(jù)交互vue-resource
本篇文章主要介紹了Vue2學(xué)習(xí)筆記之?dāng)?shù)據(jù)交互vue-resource ,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-02-02
詳解vue中在循環(huán)中使用@mouseenter 和 @mouseleave事件閃爍問題解決方法
這篇文章主要介紹了詳解vue中在循環(huán)中使用@mouseenter 和 @mouseleave事件閃爍問題解決方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-04-04
詳解element-ui表格的合并行和列(非常細(xì)節(jié))
最近在需求中遇到了elementUI合并行,索性給大家整理下,這篇文章主要給大家介紹了關(guān)于element-ui表格的合并行和列的相關(guān)資料,文中通過實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下2023-06-06

