Added support for index.js files

This commit is contained in:
airjp73 2018-01-31 15:22:02 -05:00
parent 865d3ffab9
commit 965091c8d4
4 changed files with 19 additions and 1 deletions

View File

@ -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()

View File

@ -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 => {

View File

@ -5,6 +5,8 @@
<p>{{ $store.state.counter }}</p>
<br>
<h2>{{ getVal }}</h2>
<br>
<h3>{{ getBabVal }}</h3>
</div>
</template>
@ -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'])
}
}
</script>

View File

@ -0,0 +1,9 @@
export const state = () => ({
babVal: 10
})
export const getters = {
getBabVal(state) {
return state.babVal
}
}