```
import Vuex from 'vuex';
import defaultState from './state/state.js';
import mutations from './mutations/mutations.js';
import getters from './getters/getters';
import actions from './actions/actions'
const isDev = process.env.NODE_ENV === 'development';
export default () => {
//让webpack支持对store的热替换
const store = new Vuex.Store({
strict: isDev,
state: defaultState
, mutations
, getters
, actions
});
if(module.hot){
module.hot.accept([
'./state/state'
,'./mutations/mutations'
,'./actions/actions'
,'./getters/getters'
],()=>{
//因为是export default导出的(是es6语法) 故需要require().default 引入
const newState = require('./state/state').default;
const newMutations = require('./mutations/mutations').default;
const newActions = require('./actions/actions').default;
const newGetters = require('./getters/getters').default;
store.hotUpdate({
state:newState
,mutations:newMutations
,actions:newActions
,getters:newGetters
})
});
}
return store;
};
```
- 空白目录
- vue-cli
- runtime-only
- Vue对比React
- 组件与实例
- data-binding
- computed的set和get
- scoped
- 事件
- 自定义指令
- 插件
- keep-alive
- $nextTick与生命周期
- 路由
- Vue.use(Router)
- this.$router编程式导航
- this.$route
- new Router
- routes
- mode
- linkClass
- scrollBehavior
- query
- fallback
- base
- router-view
- router-link
- 路由守卫
- 左右切换
- 滚动
- FAQ
- vuex
- 适用
- new Vuex.Store
- state
- mutations
- getters
- actions
- strict
- plugins
- modules
- namespace
- this.$store
- commit
- dispatch
- mapXX
- eventBus
- Vue工程相关
- 引用路径的简化
- css-module
- vue-loader
- 异步加载
- 支持jsx
- 让webpack支持对vuex的热替换
- .eslintrc