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 }}