vue drawer layout手势滑出菜单栏 vue-drawer-layout实现手势滑出菜单栏
任我行RQ 人气:0安装
npm install vue-drawer-layout --save
main.js导入
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>
加载全部内容