okam icon indicating copy to clipboard operation
okam copied to clipboard

[Feature Request] rematch支持

Open nyrf opened this issue 7 years ago • 0 comments

希望可以支持rematch, 现在写rematch可以用,就是直接写一个方法

inc () {
  this.$store.dipatch.count.increment()
}

computed 倒是没问题,actions写法,原生的redux写法用rematch好像不行,我自己简单改了下extend/redux里的这里

   toAction && Object.keys(toAction).forEach(k => {
        let act = toAction[k];
        toAction[k] = function (...args) {
            // this.$store.dispatch(act.apply(null, args));
            this.$store.dispatch({type: act, payload: args});

        };
    });

然后用

    actions: {
          'inc': 'count/increment',
          'dec': 'count/decrement',
          'up': 'count/up',
          'addToCart': 'cart/add',
      }

这种写法倒是可以运行

nyrf avatar Nov 12 '18 08:11 nyrf