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

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


https://segmentfault.com/q/1010000009658513

Logo

前往低代码交流专区

更多推荐