/**
 * Created by Cai Kang Jie on 2017/7/11.
 */
import $ from 'jquery'
import { mapGetters } from 'vuex'
import store from 'mainStore'
import { TOGGLE_SIDEBAR } from 'mainStore/mutation-types'
const { state } = store
export default {
  name: 'resWidthSidebar',
  mounted () {
    $(window).on('resize', _onWindowResize)
  },
  computed: mapGetters({
    sidebar: 'sidebar'
  }),
  template: '<i v-if="false"></i>'
}

function _onWindowResize () {
  if (window.innerWidth <= 1200) {
    console.log('sidebar_hide')
    store.commit(TOGGLE_SIDEBAR, true)
    console.log(state.app.sidebar.opened)
  } else {
    console.log('sidebar_show')
    store.commit(TOGGLE_SIDEBAR, false)
    console.log(state.app.sidebar.opened)
  }
}

@@ -441,16 +441,74 @@
 ze () %7B%0A
+  store.commit(TOGGLE_SIDEBAR, window.innerWidth %3C= 1200)%0A
   if (wi
@@ -570,47 +570,8 @@
 e')%0A
-    store.commit(TOGGLE_SIDEBAR, true)%0A
     
@@ -655,48 +655,8 @@
 w')%0A
-    store.commit(TOGGLE_SIDEBAR, false)%0A
     

fix bug