Skip to content

Commit 729e6c7

Browse files
committed
Fixed List.vue
1 parent 2d92c52 commit 729e6c7

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

templates/vue/components/foo/List.vue

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949
</thead>
5050
<tbody>
5151
<tr v-for="item in items">
52-
<td><router-link :to="{name: '{{{titleUcFirst}}}Show', params: { id: item['@id'] }}">\{{ item['@id'] }}</router-link></td>
52+
<td><router-link v-if="item" :to="{name: '{{{titleUcFirst}}}Show', params: { id: item['@id'] }}">\{{ item['@id'] }}</router-link></td>
5353
{{#each fields}}
54-
<td><router-link v-if="item['{{{ name }}}']" :to="{name: '{{{titleUcFirst}}}Show', params: { id: item['@id'] }}">\{{ item['{{{ name }}}'] }}</router-link></td>
54+
<td><router-link v-if="item" :to="{name: '{{{../titleUcFirst}}}Show', params: { id: item['@id'] }}">\{{ item['{{{ name }}}'] }}</router-link></td>
5555
{{/each}}
5656
<td>
5757
<router-link :to="{name: '{{{titleUcFirst}}}Show', params: { id: item['@id'] }}">
@@ -75,18 +75,20 @@
7575
</template>
7676

7777
<script>
78-
import { mapGetters, mapActions } from 'vuex';
78+
import { createNamespacedHelpers } from 'vuex';
7979
80-
export default {
81-
computed: mapGetters([
82-
'items',
83-
'view'
84-
]),
85-
methods: mapActions([
86-
'getPage'
87-
]),
88-
created () {
89-
this.$store.dispatch('getItems')
80+
const { mapActions, mapGetters } = createNamespacedHelpers('{{{lc}}}/list');
81+
82+
export default {
83+
computed: mapGetters([
84+
'items',
85+
'view'
86+
]),
87+
methods: mapActions([
88+
'getPage'
89+
]),
90+
created () {
91+
this.$store.dispatch('{{{lc}}}/list/getItems')
92+
}
9093
}
91-
}
9294
</script>

0 commit comments

Comments
 (0)