Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

Recent questions tagged vuex

0 votes
1.1k views
1 answer
    I use this code to watch mutations, but the CB triggers only if old and new Values would NOT be equal, VX ... .com/questions/65647502/watch-on-store-mutations-even-for-same-values...
asked Oct 7, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    vuex 内mutation 方法同级互相调用? setAlert(state, data){ console.log(JSON.stringify(data)); data.btns = data.btns || []; ... }, hideAlert(state){ state.uiAlert.title=state.uiAlert.msg=""; }...
asked Feb 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    现有代码如下 需要store.state.auth.user有信息才next();,如果没有则执行store.dispatch("getUserInfo");为store.state.auth.user获取值 现在的问题时当store.state. ... 样的undefined.证明getUserInfo还没执行完就执行了以下的方法 是不是我哪里写错了?...
asked Feb 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.0k views
1 answer
    学习vuex购物车示例,他是如何做到减物品数量的,看了下代码,加入购物车执行了addToCart action, action 调用了 `types.ADD_TO_CART` mutations,cart、product都实现了这个mutation,一个完成加入物品到购物车,一个实现减库存,是否有先后顺序问题啊...
asked Feb 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.0k views
1 answer
    vuex 子组建获取store中state为undefined,main.js中import store 后在footer.vue用this.$store.state.count获取值为undefined,但是如果把store里定义的store直接 ... return this.$store.state.count; } } } </script>```...
asked Feb 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
911 views
1 answer
    // store export default new Vuex.Store({ state, mutations, modules: { car: { store: { cost: 'xxxx' } } }, strict: ... computed: { test () { return this.$store.state.car.data } }...
asked Feb 6, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.0k views
1 answer
    当你的store拆分了很多module,moduleA 的state字段需要在初始状态等于moduleB的某个字段值,该怎么处理好些?...
asked Feb 6, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
913 views
1 answer
    我在根组件中注入了store,然后在子组件中通过this.$store来访问store中的数据,然后我发现组件实例上根本不存在$store的属性,我在github上看vuex的demo,发现并没有区别 求助各位大神看 ... router:router, store, //这里已经注入到根组件中了啊? render:h=>h(AppComponent) })...
asked Feb 6, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    vue版本2.2.2, vue版本2.2.1 // actions代码 const actions = { updateUser ({ commit }, { username }) { console.log( ... Error: [vuex] Expects string as the type, but found undefined. why?...
asked Feb 6, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
850 views
1 answer
    input绑定v-model,先通过state赋值给v-model,修改后重新保存到v-model中, mutations里面写的保存方法,怎样使3个input框公用一个方法呢...
asked Feb 6, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
861 views
1 answer
    场景是这样的,我登陆的时候我对路由进行了 addRoutes 操作。但退出后我要把追加进去的路由给删除掉。 退出的时候我写了个 actions 方法因为多个地方有调用 退出 actions .所以想把删除原路由的写到 actions 但我怎么拿路由里面都拿不到! 想请教下如何在 actions 里操作路由且还生效。...
asked Feb 6, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
763 views
1 answer
    在做一个商城首页商品列表中添加购物车的功能,就是酱紫 商品列表itemList在home这个module里面,购物车的数据存在localStroage里的cart里面 想要把修改商品数量的这个部分做成一个小组件countModule, ... 以前用的vue1.x 组件间的调用都是dispatch 和 broadcast,刚开始用2.x不太熟悉,望大神指点...
asked Feb 5, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
877 views
1 answer
    比如说一个评论功能,,参考思否自身的评论,像这样可以在文章的评论中进行评论,即主评论中包含子评论, 文章 评论 子评论 这样三级的数据,是否要将文章列表放置在 vuex 中, 1:若不放在 vuex 中,新增评论等其他操作,数据如何直接同步刷新; 2:若放在 vuex 中,更新或新增一个子评论,怎么设计比较好?传数组索引吗?一层层传递?...
asked Jan 29, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
901 views
1 answer
    比如说一个评论功能,,参考思否自身的评论,像这样可以在文章的评论中进行评论,即主评论中包含子评论, 文章 评论 子评论 这样三级的数据,是否要将文章列表放置在 vuex 中, 1:若不放在 vuex 中,新增评论等其他操作,数据如何直接同步刷新; 2:若放在 vuex 中,更新或新增一个子评论,怎么设计比较好?传数组索引吗?一层层传递?...
asked Jan 29, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
822 views
1 answer
    子modules 无state数据,打算只操作根的state export default new Vuex.Store({ state: { // 希望 aa能操作这里的数据 }, getters: { }, mutations: { }, ... 两份mutations其实代码一样,只是为了操作同一份state 请问有什么其他方法吗?...
asked Jan 29, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
851 views
1 answer
    axios 在store文件里是用于获取数据,在main.js 是要往vue原型上挂,以便组件里获取数据。 两个文件各自引入axios,是否消耗更大的内存? 能否共用同一个axious?有啥建议方式。...
asked Jan 29, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.0k views
1 answer
    vuex 使用this.$store.dispatch()改变vuex的值, 报错Cannot read property 'dispatch' of undefined问题 首先定义好且引入正确了,我在普通的组件中,调用 this.$store. ... 用$store.dispatch()就不行,请问下是什么原因呢,又该如何解决呢?感激不尽...
asked Jan 29, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
898 views
1 answer
    组件的关系 实际效果 点击 -> 未完成 会进行筛选 // 菜单回调 handleSelect(index) { switch (index) { case '未完成': this.typeData.statuses = ['undo', 'doing', ' ... 不明白这种情况下为什么会触发两次watch 求大佬指导 或者有其他的方法传值也可以 谢谢...
asked Jan 27, 2021 in Technique[技术] by 深蓝 (71.8m points)
To see more, click for the full list of questions or popular tags.
Ask a question:
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...