mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
Added support for index.js files
This commit is contained in:
parent
865d3ffab9
commit
965091c8d4
@ -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()
|
||||
|
@ -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 => {
|
||||
|
5
test/fixtures/basic/pages/store.vue
vendored
5
test/fixtures/basic/pages/store.vue
vendored
@ -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>
|
||||
|
9
test/fixtures/basic/store/bab/index.js
vendored
Normal file
9
test/fixtures/basic/store/bab/index.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
export const state = () => ({
|
||||
babVal: 10
|
||||
})
|
||||
|
||||
export const getters = {
|
||||
getBabVal(state) {
|
||||
return state.babVal
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user