Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

139
Views
Dom no actualiza la variable de estado de Vuex

Entonces, mi problema es que parece que no puedo ver la variable coolEventScore cuando se carga la página. No sé si es algo que tiene que ver con los ciclos de vida, o tal vez estoy sobrecargando la funcionalidad dentro de la función vuex getListStats()... ¿Alguien podría arrojar algo de luz sobre esto?

cuenta.js

 import Vue from 'vue' import {achost} from '../constants'; const state = () => ({ coolEventScore: {} }); const actions = { getListStats(context) { return Vue.axios.get( `xxxx/xxxx`, {}, { headers: { 'XXXX': 'xxxx', 'XXXX': xxxx } }).then((resp) => { let events = resp.data['event_info']; let coolEvt = events.filter(evt => evt.src === "coolEvt")[0]; let coolEvtScore = coolEvt .score; context.commit("setCoolEventScore", coolEvtScore) return events; }).catch((err) => { console.log(err) }) }, } const mutations = { setCoolEventScore(state, value) { state.coolEventScore = value; } } export const account = { namespaced: true, actions, mutations, state }

Cool.vue

 <template> <div> <span :html="coolEventScore"></span> </div> </template> <script> import store from "../../../store"; import { mapState } from "vuex"; import { account } from "../../../store/modules/account"; if (!store.state.account) store.registerModule("account", account); export default { name: "Cool", components: {}, created() { this.fetchEvents(); }, computed: { ...mapState("account", { coolEventScore: (state) => state.coolEventScore }), }, methods: { fetchEvents() { this.$store.dispatch("account/getListStats"); } } }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!