lambda-view icon indicating copy to clipboard operation
lambda-view copied to clipboard

ES6 ... feature support required

Open KingMario opened this issue 8 years ago • 3 comments

  computed: {
    cartOpened: {
      get () {
        return this._cartOpened
      },
      set (val) {
        this.setCartOpened(val)
      }
    },
    ...mapState({
      cart: state => state.shop.cart,
      products: state => state.shop.products,
      _cartOpened: state => state.shop.cartOpened
    })
  },

The statement ...mapState({ will cause error

lv main.js [2017-2-21 11:29:01] INFO processing target: /Users/Mario/Work/Projects/maserati/src/main.js [2017-2-21 11:29:01] ERROR Line 143: Unexpected token ...

KingMario avatar Feb 21 '17 03:02 KingMario

@KingMario 这看起来不是一个合法的代码片段。能运行?

Jianru-Lin avatar Feb 21 '17 04:02 Jianru-Lin

@Jianru-Lin 这是 ES6 stage-3 的对象展开运算符 https://github.com/sebmarkbage/ecmascript-rest-spread,可以通过 babel 转译

KingMario avatar Feb 21 '17 04:02 KingMario

@KingMario 好的,我研究下

Jianru-Lin avatar Feb 21 '17 06:02 Jianru-Lin