&quot“ getWatchLength”不是在实例上定义的,而是在渲染过程中引用的。确保在数据选项中声明反应性数据VUE JS属性
我有一个Vuex商店,它存储了监视产品长度的状态,我会在商店中获得产品长度,但是每次尝试在代码中尝试{{getWatchLength}}时,我都会获得“ getWatchLength
”我进入控制台 https://imageshack.com/i/pmlnox9nj
这是我的VUEX商店 https://imageshack.com/i/pmp87o5ij
<template>
<div id="app">
{{ getWatchLength }}
<router-view></router-view>
</div>
</template>
我的脚本标签
<script>
import { mapActions } from "vuex";
import { mapGetters } from "vuex";
export default {
name: "app",
data() {
return {
categoryID: null,
categories: [],
products: [],
show: null
};
},
computed: {
...mapGetters( ["getWatchLength"], ["isLoggedIn"])
}
};
</script>
,我不知道我在做什么错
I've a vuex store which stores the state of the length of watched products, I get the length of product in my store but each time I try to {{getWatchlength}} in my code i get "getWatchlength" not defined
This the error I get in my console https://imageshack.com/i/pmlnoX9nj
This my vuex store
https://imageshack.com/i/pmP87O5Ij I'm getting the length in my store
This my html code
<template>
<div id="app">
{{ getWatchLength }}
<router-view></router-view>
</div>
</template>
My script tag
<script>
import { mapActions } from "vuex";
import { mapGetters } from "vuex";
export default {
name: "app",
data() {
return {
categoryID: null,
categories: [],
products: [],
show: null
};
},
computed: {
...mapGetters( ["getWatchLength"], ["isLoggedIn"])
}
};
</script>
Please, I don't know what I'm doing wrong
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试以下类似:
Try like following: