import { mapState } from 'vuex' import menuMixin from '../mixin/menu' import { createMenu } from '../libs/util.menu' import BScroll from 'better-scroll' export default { name: 'ibps-layout-header-aside-menu-side', mixins: [ menuMixin ], render(h) { return
}, data() { return { asideHeight: 300, BS: null } }, computed: { ...mapState('ibps/menu', [ 'aside', 'asideCollapse', 'asideTransition' ]) }, watch: { // 折叠和展开菜单的时候销毁 better scroll asideCollapse(val) { this.scrollDestroy() setTimeout(() => { this.scrollInit() }, 500) }, }, mounted() { // 这个插件会影响到滚动效果 修复菜单栏无法滚动的bug 先注释掉 // this.scrollInit() }, beforeDestroy() { this.scrollDestroy() }, methods: { scrollInit() { this.BS = new BScroll(this.$el, { mouseWheel: true, click: true // 如果你愿意可以打开显示滚动条 // scrollbar: { // fade: true, // interactive: false // } }) }, scrollDestroy() { try { this.BS.destroy() } catch (e) { delete this.BS this.BS = null } } } }