2017-03-02 108 views
1

x.vue文件在没有Object.assign的情况下使用mapActions错误?

methods: { 
    ...mapActions([ 
     'fetchTopicVideo', 
    ]), 
} 

这将是抛出错误,错误信息是:

ERROR in ./~/buble-loader!./~/vue-loader/lib/selector.js? 

type=script&index=0!./src/components/CardList.vue 
Module build failed: 
43 :  // }, (res) => { 
44 :  // console.log('query error') 
45 :  // }) 
46 : }, 
47 : methods: { 
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
Object spread operator requires specified objectAssign option with 'Object.assign' or polyfill helper. (47:11) 
@ ./src/components/CardList.vue 7:2-105 
@ ./~/buble-loader!./~/vue-loader/lib/selector.js?type=script&index=0!./src/views/ClientTopicShare.vue 
@ ./src/views/ClientTopicShare.vue 
@ ./src/router/index.js 
@ ./src/app.js 
@ ./src/client-entry.js 
@ multi webpack-hot-middleware/client ./src/client-entry.js 

但下面的代码不会抛出错误:

methods: Object.assign({}, 
    mapActions([ 
    'fetchTopicVideo' 
    ]) 
) 

.babelrc文件:

{ 
    "presets": ["es2015", "stage-2"], 
    "plugins": ["transform-runtime"], 
    "comments": false 
} 

也许babel失败导致这一点。

+0

你说得对有关问题正在与巴别塔,你可以分享你的package.json以及? –

+0

通过https://github.com/vuejs/vue-hackernews-2.0/issues/87 – Youngbye

回答

相关问题