// getter的key不允许重复,否则会报错
return
}
store._wrappedGetters[getterKey] = function `wrappedGetter` (store{
// 将每一个getter包装成一个方法,并且添加到store._wrappedGetters对象中,
return rawGetter(
//执行getter的回调函数,传入三个参数,(local state,store getters,rootState)
getNestedState(store.state, modulePath), // local state
//根据path查找state上嵌套的state
store.getters,
// store上所有的getters
store.state
// root state)}})
}
//根据path查找state上嵌套的state
function `getNestedState` (state, path) {
return path.length
? path.reduce((state, key) => state[key], state): state}










