search

Home  >  Q&A  >  body text

javascript - ...mapGetters error

     import { mapGetters,mapActions } from 'vuex'
    export default {
        data (){
            let change = 'hot';
            return {change}
        },
        computed:{
            ...mapGetters({
                topic:'getTopics',
                show:'getShow_2'
            })
        },
        methods:{
            ...mapActions([
                'sortContent'
                ])
        }
    }

The above code reports the following error, how to solve it?


Syntax Error: Unexpected token (38:2)

  36 |  },
  37 |  computed:{
> 38 |          ...mapGetters({
     |          ^
  39 |                  topic:'getTopics',
  40 |                  show:'getShow_2'
  41 |          })
習慣沉默習慣沉默2781 days ago752

reply all(2)I'll reply

  • 迷茫

    迷茫2017-06-12 09:32:45

    It should be that the ES6 compilation tool is not installed. npm installTry it out

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-06-12 09:32:45

    These three points are called Spread operator, which is the syntax of ES6. If your running environment does not support it, an error will occur.

    Generally, Babel must be configured correctly for conversion.

    reply
    0
  • Cancelreply