简体   繁体   English

我如何为多个 vuex 模块使用扩展运算符?

[英]How do i use spread operator for multiple vuex modules?

I looked into another post describing that this should work, but I keep getting the errormessage: ' TypeError: Cannot convert undefined or null to object '我查看了另一篇描述这应该有效的帖子,但我不断收到错误消息:' TypeError:无法将 undefined 或 null 转换为 object '

computed: {

    ...mapGetters ("candidates", ["people"] ),

    ...mapGetters ("editPersonDialog" ["tasks"] ),

}

There is a typo, a comma is missing in "editPersonDialog" ["tasks"] .有一个错字, "editPersonDialog" ["tasks"]缺少逗号。 This means that tasks key is retrieved from editPersonDialog string.这意味着从editPersonDialog字符串中检索tasks键。 Since there's no tasks in String.prototype , "editPersonDialog" ["tasks"] === undefined .由于String.prototype没有tasks ,因此"editPersonDialog" ["tasks"] === undefined

It should be:它应该是:

computed: {

    ...mapGetters ("candidates", ["people"] ),

    ...mapGetters ("editPersonDialog", ["tasks"] ),

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM