vuex ...mapActions(['methods1']) 释疑

mapActions() 返回的是一个对象, 用了 ... 扩展符后,才可以放进一个对象里,和其他组件内定义的 method 在同一个 methods 对象。

{
    methods: mapActions() // 如果没有其它组件内的定义的方法,可以这样写
}


{
    methods: {
        ...mapActions(),// 如果有其他定义的方法
        otherMethod1 () {},
        otherMethod2 () {}
}

https://segmentfault.com/q/1010000009658513

posted @ 2020-11-17 11:16  晨光曦微  阅读(394)  评论(0编辑  收藏  举报