用于模块导出的js扩展运算符

时间:2017-08-25 13:36:48

标签: javascript

如何使用点差运算符将其作为单行代码:

const module = extractVuexModule( Activities )

export const state = module.state
export const getters = module.getters
export const mutations = module.mutations
export const actions = module.actions

1 个答案:

答案 0 :(得分:2)

您可以object destructuring使用named exports

export const { state, getters, mutations, actions } = extractVuexModule(Activities);