vue-drawer-layout實(shí)現(xiàn)手勢滑出菜單欄
本文實(shí)例為大家分享了vue-drawer-layout實(shí)現(xiàn)手勢滑出菜單欄的具體代碼,供大家參考,具體內(nèi)容如下
安裝
npm install vue-drawer-layout --save
main.js導(dǎo)入
import DrawerLayout from 'vue-drawer-layout' Vue.use(DrawerLayout)
完整代碼
<template> <div class="box"> <vue-drawer-layout :drawer-width="230" ref="drawerLayout" @mask-click="closeMenu()"> <div class="drawer" slot="drawer"> <div>菜單欄</div> </div> <div class="content" slot="content"> <button type="primary" @click="openMenu()">打開菜單欄</button> </div> </vue-drawer-layout> </div> </template> <script> export default { data() { return {}; }, mounted() {}, methods: { openMenu() { this.$refs.drawerLayout.toggle(); }, closeMenu() { this.$refs.drawerLayout.toggle(false); }, }, }; </script> <style lang="less" scoped> .drawer { width: 100%; height: 100%; background: #fff; } </style>
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
vue2導(dǎo)航根據(jù)路由傳值,而改變導(dǎo)航內(nèi)容的實(shí)例
下面小編就為大家?guī)硪黄獀ue2導(dǎo)航根據(jù)路由傳值,而改變導(dǎo)航內(nèi)容的實(shí)例。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-11-11使用vue實(shí)現(xiàn)計(jì)時(shí)器功能
這篇文章主要為大家詳細(xì)介紹了使用vue實(shí)現(xiàn)計(jì)時(shí)器功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-08-08vue中for循環(huán)更改數(shù)據(jù)的實(shí)例代碼(數(shù)據(jù)變化但頁面數(shù)據(jù)未變)
這篇文章主要介紹了vue中for循環(huán)更改數(shù)據(jù)的實(shí)例代碼(數(shù)據(jù)變化但頁面數(shù)據(jù)未變)的相關(guān)資料,需要的朋友可以參考下2017-09-09vue用addRoutes實(shí)現(xiàn)動(dòng)態(tài)路由的示例
本篇文章主要介紹了vue用addRoutes實(shí)現(xiàn)動(dòng)態(tài)路由的示例,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-09-09VSCode寫vue項(xiàng)目一鍵生成.vue模版,修改定義其他模板的方法
這篇文章主要介紹了VSCode寫vue項(xiàng)目一鍵生成.vue模版,修改定義其他模板的方法,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-04-04