[Vuejs]-Vue – why can't I display the result of my axios get request in vuex?

0πŸ‘

βœ…

for test make a new laravel project and do the specefic example with vue and vuex , I see it’s work !

As a result I just make new laravel project and move my files in there with precisely step by step,

and it’s work perfectly 😐 πŸ˜‰

sorry my engilish is not good enough πŸ˜‰

good Luck …

0πŸ‘

Assuming you wrote this chunk of code inside the computed key.

1 //    ...mapGetters([
2 //        'DoctorsPerDayData'
3 //     ]),
4 //    DoctorsPerDayData (){
5 //        return this.$store.state.DoctorsPerDay
6 //    }
7       DoctorsPerDayData : {
8           get(){
9               return this.$store.state.DoctorsPerDay
10          }
11      }

Posible solution 1

For block in line 1-3 I’ve previously used mapGetters as a way to convert upper camel case into camel case like this.

...mapGetters({
    doctorsPerDayData: 'DoctorsPerDayData'
}),

After this you may use doctorsPerDayData in your <template>...html</template> like this <specialist v-for="doctor in doctorsPerDayData" :key="doctor.id">

Posible solution 2

Then I would say in block line 7-11 it should be return this.$store.getters.DoctorsPerDay note the difference of getters instead of state.

Leave a comment