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 | })
It should be that the ES6 compilation tool is not installed.
npm install
Try it outThese 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.