Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use spread operator. #54

Open
Tobi696 opened this issue May 14, 2019 · 1 comment
Open

Can't use spread operator. #54

Tobi696 opened this issue May 14, 2019 · 1 comment

Comments

@Tobi696
Copy link

Tobi696 commented May 14, 2019

I can't spread the returning of vuex's mapState/mapMutations/...
This code:

<template>
    <Window title="Vuido Example" width="400" height="100" margined v-on:close="$exit">
        <Box padded>
            <Text>
                {{ name }}
            </Text>
        </Box>
    </Window>
</template>

<script>
import { mapState, mapMutations } from 'vuex'

export default {
    data: () => ({

    }),
    computed: {
        ...mapState([
            'name'
        ])
    }
}
</script>

Throws following error:
ERROR in ./src/MainWindow.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/MainWindow.vue?vue&type=script&lang=js&)
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: Unexpected token (19:8)

17 | },
18 | computed: {
19 | ...mapState([
| ^
20 | 'name'
21 | ])
22 | }

@mimecorg
Copy link
Owner

You need to install the transform-object-rest-spread babel plugin and add it to .babelrc because it's not included by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants