vue ...mapActions()含义 (es6 剩余操作符)

来源:互联网 发布:服务器端口检测工具 编辑:程序博客网 时间:2024/06/03 12:58

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

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

原创粉丝点击