vuex-modules

How can I upload file using vuex store on the vue component?

时光怂恿深爱的人放手 提交于 2020-01-06 06:03:48
问题 If I using ajax in vue component like this : It works. I successfully get the file But here I want to using vuex store My pattern of vuex store like this : I change my vue component like this : <template> <div> ... </div> </template> <script> export default { methods: { submitForm() { ... formData.append('file', files) this.updateProfile({formData, reload: true}) } } } </script> In the component vue, it will call updateProfile method in modules user The modules user like this : import { set }

How to call ajax only when show detail on vue component?

不打扰是莪最后的温柔 提交于 2019-12-29 02:07:29
问题 I have two component. I set and get data by vuex store My first component like this : <template> <ul class="list-group"> <li v-for="item in getOrderList" class="list-group-item"> .... <a href="javascript:" class="toggle-show" aria-expanded="false" data-toggle="collapse" :data-target="'#' + item.id" @click="showDetailOrder(item.id)"> Show <span class="caret"></span> </a> ... <div class="collapse" :id="item.id"> <template v-if="getOrderDetail.id"> <order-collapse/> </template> </div> </li> </ul

Subfolder in the Nuxt store is messing with the modules

有些话、适合烂在心里 提交于 2019-12-25 01:25:05
问题 Trying to create a project in Nuxt and typescript. However the documentation it's very poor and I hit a lot of issues. Somehow was able to solve most of them, but stacked on an issue with the store . Based on the Nuxt documentation every file inside the store directory is transformed to a module. To organize better my project I decided to add a subfolder inside store folder. However after this change my components are having issues with calling Mutation , Action and getting values from the

Nuxt, splitting up Vuex store into separate files gives error: unknown mutation type: login

随声附和 提交于 2019-12-11 08:42:53
问题 I'm trying to split up my Nuxt Vuex store files into separate files . And NOT have all Vuex getters , mutations and actions into one huge file. This demo project is on Github by the way. I'v read this official Nuxt Vuex Store documentation; but can't seem to get it working. It's a bit vague on where to put stuff. I have the following in these files: Below is my: store/index.js import Vue from "vue"; import Vuex from "vuex"; import Auth from "./modules/auth"; Vue.use(Vuex); export const store

vuex not loading module decorated with vuex-module-decorators

时光总嘲笑我的痴心妄想 提交于 2019-12-09 23:11:17
问题 I get this error when trying to load a store module with the vuex-module-decorators into the initialiser: vuex.esm.js?2f62:261 Uncaught TypeError: Cannot read property 'getters' of undefined at eval (vuex.esm.js?2f62:261) at Array.forEach () at assertRawModule (vuex.esm.js?2f62:260) at ModuleCollection.register (vuex.esm.js?2f62:186) at eval (vuex.esm.js?2f62:200) at eval (vuex.esm.js?2f62:75) at Array.forEach () at forEachValue (vuex.esm.js?2f62:75) at ModuleCollection.register (vuex.esm.js

vuex not loading module decorated with vuex-module-decorators

Deadly 提交于 2019-12-04 18:49:35
I get this error when trying to load a store module with the vuex-module-decorators into the initialiser: vuex.esm.js?2f62:261 Uncaught TypeError: Cannot read property 'getters' of undefined at eval (vuex.esm.js?2f62:261) at Array.forEach () at assertRawModule (vuex.esm.js?2f62:260) at ModuleCollection.register (vuex.esm.js?2f62:186) at eval (vuex.esm.js?2f62:200) at eval (vuex.esm.js?2f62:75) at Array.forEach () at forEachValue (vuex.esm.js?2f62:75) at ModuleCollection.register (vuex.esm.js?2f62:199) at new ModuleCollection (vuex.esm.js?2f62:160) The index.ts file is quite simple and all

How can I send data from parent to child component by vuex store in vue component?

空扰寡人 提交于 2019-11-29 18:05:18
My parent component like this : <template> ... <search-result/> ... </template> <script> import {mapActions} from 'vuex' ... export default { ... props: ['category'], mounted() { this.updateCategory(this.category) }, methods: { ...mapActions(['updateCategory']), } } </script> My child component like this : <template> ... </template> <script> import {mapGetters} from 'vuex' ... export default { ... mounted() { console.log(this.getCategory) }, computed: { ...mapGetters(['getCategory']) }, } </script> My modules vuex to send data between components like this : import { set } from 'vue' ... //

How can I send data from parent to child component by vuex store in vue component?

馋奶兔 提交于 2019-11-28 11:53:25
问题 My parent component like this : <template> ... <search-result/> ... </template> <script> import {mapActions} from 'vuex' ... export default { ... props: ['category'], mounted() { this.updateCategory(this.category) }, methods: { ...mapActions(['updateCategory']), } } </script> My child component like this : <template> ... </template> <script> import {mapGetters} from 'vuex' ... export default { ... mounted() { console.log(this.getCategory) }, computed: { ...mapGetters(['getCategory']) }, } <

How can I solve “Uncaught TypeError: Cannot read property 'get' of undefined” in the vuex store?

非 Y 不嫁゛ 提交于 2019-11-27 08:25:01
问题 If I try this .$session.get(SessionKeys.Cart) in my component like this : <template> ... </template> <script> ... export default { ... methods: { add(item) { console.log(this.$session.get(SessionKeys.Cart) ... } } } </script> It works. I success get session cart But if I try it in the my vuex store like this : import { set } from 'vue' // initial state const state = { list: {} } // getters const getters = { list: state => state.list } // actions const actions = { addToCart ({ dispatch,commit

How to make dynamic routes on the vue router?

大城市里の小女人 提交于 2019-11-26 11:41:45
问题 My MainNavBar component like this : <template> ... <v-list-item v-for=\"(item, index) in listMenu\" :key=\"index\" @click=\"goTo(item)\" > <v-list-item-content> <v-list-item-title>{{ item }}</v-list-item-title> </v-list-item-content> </v-list-item> ... </template> <script> export default { ... methods: { goTo(key) { this.$router.push({ name: key }); }, ...mapActions(\"dataStore\", [\"getMenu\"]) }, computed: { ...mapGetters(\"dataStore\", [\"listMenu\"]) } }; </script> listMenu taken from API