vuex Questions
3
Solved
I want to detect changes in a Vuex state value by watching it in a Vue component. I am currently using Vue 3 with the composition API. I've tried the following approach:
setup(props) {
const store...
Arrhythmia asked 31/5, 2021 at 14:36
9
Solved
I have the following Vuex store (main.js):
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
//init store
const store = new Vuex.Store({
state: {
globalError: '',
user: {
authentica...
Lefton asked 5/3, 2017 at 2:48
3
I have an AuthService that I use in a namespaced store in my Nuxt app. I need to commit mutations from AuthService to the namespaced store but I can't figure out how to import the store into my Aut...
Stated asked 14/2, 2020 at 1:55
4
I install and create a project vue with VUE CLI.
I would like to add VUEX to add a store in my app.
But when I use:
npm install vuex --save-dev
I have errors:
Could not resolve dependency:peer vu...
5
Solved
I've deployed a VueJS project to a domain like www.example.com/demos/app,
But when I send a request to api from axios it is pointing to www.example.com/login instead of www.example.com/demos/app/l...
Stesha asked 1/9, 2017 at 7:47
6
Solved
I'm refactoring component from regular Vue 3 Composition API to Script Setup syntax. Starting point:
<script lang="ts">
import { defineComponent, computed } from 'vue';
import { map...
Rosemari asked 22/9, 2020 at 12:47
3
In Vuex, I have my mutations object as follows:
mutations: {
someMethod(){
this.someReusableCode();
},
anotherMethod(){
this.someReusableCode();
},
someReusableCode(){
...
}
}
However...
Marozik asked 12/1, 2018 at 4:9
2
Solved
I have been using Vuex for awhile now, and I have always been following the pattern: Components use Actions to commit Mutations to mutate the Store. I thought this was the proper way to do things c...
Boccioni asked 4/4, 2018 at 23:31
8
Solved
I want to access state.session in instance.js from records_view.js. How is this accomplished?
store/modules/instance.js
const state = {
// This is what I want to access in records_view.js
sessi...
Fubsy asked 28/12, 2016 at 16:52
2
If I try this .$session.get(SessionKeys.Cart) in my component like this :
<template>
...
</template>
<script>
...
export default {
...
methods: {
add(item) {
console.log...
Incorporate asked 27/9, 2018 at 4:12
3
I have a component, which looks like this:
export default {
name: 'todos',
props: ['id'],
created () {
this.fetchData()
},
data() {
return {
}
},
computed: {
todos () {
return this.$st...
2
/src/middlewares/auth.ts file:
import store from '@/store'
export default {
guest(): void {
if (store.state.auth.authenticated === false) {
// do some action
}
}
}
/src/store.ts file:
imp...
Apatite asked 12/8, 2019 at 20:2
4
Solved
I have made vuex namespaced getter mapping in my .vue component like this:
...mapGetters([
'fooModule/barGetter'
])
How do I access this getter in the .vue component template?
I have tried {{fooM...
7
I'm trying to type hint my props in a Vue 3 component, with composition API.
So, I'm doing this:
<script lang="ts">
import FlashInterface from '@/interfaces/FlashInterface';
import ...
Arietta asked 14/11, 2020 at 7:21
5
I want to install Vuex but I get an error.
// error
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Fo...
2
Solved
I am trying to get into the way of things with Vue but I've got some troubles with:
1: I cannot get access to my getters from router/index.js file. (I can get access to it but it return like a fu...
Idona asked 19/4, 2020 at 10:16
10
Solved
Why do I get this error:
Error [vuex] Do not mutate vuex store state outside mutation handlers.
What does it mean?
It happens when I try to type in the edit input file.
pages/todos/index.vue
<...
3
Using the vuex-module-decorator I have a authenticate action that should mutate the state.
@Action
public authenticate(email: string, password: string): Promise<Principal> {
this.principal ...
Consubstantial asked 10/1, 2019 at 11:11
5
Solved
I have a few application, when I am sending formdata using axios post data is successfully sent to API. but when i am using put request its not working with formData.
<template>
<div cla...
2
Solved
I have a Vue app using Vuex. If I have two tabs open, changes to the store in one tab do not show in the other.
How can I make sure store/data across all tabs is synced instantly?
const store = ...
2
Solved
I'm in Vue 3, I started with adding a new Vuex.Store to vue, but I continuously get this javascript error. I also tried the same thing with createStore since I use Vue 3, but it's still the same.
W...
Inheritrix asked 27/10, 2020 at 11:4
3
so in my Vue-project I basically have two pages/components that will be shown with the use of vue-router depending on the URL. I can switch between those pages/components via a button.
I am also us...
Beret asked 25/5, 2020 at 15:43
3
Solved
Within a vuex getter I know it is possible to access the state from another vuex module like so:
pages: (state, getters, rootState) => {
console.log(rootState);
}
How can I access a getter f...
Mindszenty asked 1/9, 2017 at 11:47
22
Solved
I am using vuex and vuejs 2 together.
I am new to vuex, I want to watch a store variable change.
I want to add the watch function in my vue component
This is what I have so far:
import Vue from...
Hooch asked 7/4, 2017 at 5:13
2
I am a Vue.js developer who is coming up to speed with the the new features added to Vue 3, from Vue 2, namely the Composition API (added in Vue 3).
For State Management, it appears that alon...
© 2022 - 2024 — McMap. All rights reserved.