import { mapState } from 'vuex' import menuMixin from '../mixin/menu' import { createMenu } from '../libs/util.menu' import BScroll from 'better-scroll' export default { name: 'd2-layout-header-aside-menu-side', mixins: [ menuMixin ], render (h) { return
}, data () { return { asideHeight: 300, BS: null } }, computed: { ...mapState('d2admin/menu', [ 'aside', 'asideCollapse', 'asideTransition' ]) }, watch: { // 折叠和展开菜单的时候销毁 better scroll asideCollapse (val) { this.scrollDestroy() setTimeout(() => { this.scrollInit() }, 500) } }, mounted () { this.scrollInit() }, beforeDestroy () { this.scrollDestroy() }, methods: { scrollInit () { this.BS = new BScroll(this.$el, { mouseWheel: true, click: true // 如果你愿意可以打开显示滚动条 // scrollbar: { // fade: true, // interactive: false // } }) }, scrollDestroy () { // https://github.com/d2-projects/d2-admin/issues/75 try { this.BS.destroy() } catch (e) { delete this.BS this.BS = null } } } }