问题标签 [vuex4]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
17 浏览

vue.js - 如何在 vuex 中显示 store 中的值

我将数据存储在 Vuex 商店中。这里的样子:

在此处输入图像描述

基本上,我想在视图中显示 first_name 。所以我返回了这样的数据:

Ans 很容易想在 div 中显示它:

但我得到vue.esm.js:1906 TypeError: Cannot read properties of undefined (reading 'first_name')

0 投票
0 回答
20 浏览

vue.js - 我需要将数据从getter传递给vuex 4中的动作,但我不知道我是否做得对

我需要将数据从 getter 传递到 vuex 4 中的操作,但我不知道我是否做得对。我应该怎么做呢?应该注意的是,getter 正在从位于不同模块中的另一个 getter 中获取状态数据。