diff --git a/lib/app/store.js b/lib/app/store.js index 2b93e69600..127506e66c 100644 --- a/lib/app/store.js +++ b/lib/app/store.js @@ -42,6 +42,11 @@ if (typeof storeData !== 'function') { continue } + //if file is user/index.js + //it should save as user + if (name === 'index') + namePath.pop() + let module = getModuleNamespace(storeData, namePath) name = namePath.pop() diff --git a/test/basic.csr.test.js b/test/basic.csr.test.js index cda6890a1e..e5848df54d 100644 --- a/test/basic.csr.test.js +++ b/test/basic.csr.test.js @@ -81,6 +81,7 @@ test.serial('/store', async t => { t.is(await page.$text('h1'), 'Vuex Nested Modules') t.is(await page.$text('p'), '1') t.is(await page.$text('h2'), '4') + t.is(await page.$text('h3'), '10') }) test.serial('/head', async t => { diff --git a/test/fixtures/basic/pages/store.vue b/test/fixtures/basic/pages/store.vue index f9efbd1175..d9d834cd51 100644 --- a/test/fixtures/basic/pages/store.vue +++ b/test/fixtures/basic/pages/store.vue @@ -5,6 +5,8 @@

{{ $store.state.counter }}


{{ getVal }}

+
+

{{ getBabVal }}

@@ -14,7 +16,8 @@ import { mapGetters } from 'vuex' export default { computed: { ...mapGetters('foo/bar', ['baz']), - ...mapGetters('foo/blarg', ['getVal']) + ...mapGetters('foo/blarg', ['getVal']), + ...mapGetters('bab', ['getBabVal']) } } diff --git a/test/fixtures/basic/store/bab/index.js b/test/fixtures/basic/store/bab/index.js new file mode 100644 index 0000000000..babbad5bf2 --- /dev/null +++ b/test/fixtures/basic/store/bab/index.js @@ -0,0 +1,9 @@ +export const state = () => ({ + babVal: 10 +}) + +export const getters = { + getBabVal(state) { + return state.babVal + } +}