Skip to content

"computed" property is called immediately #79

@mickeyvip

Description

@mickeyvip

I am trying to play with the new composition API.

Installed the plugin and copied the "Basic example" from https://vue-composition-api-rfc.netlify.com/#basic-example.

It throws an exception inside the computed getter.

[Vue warn]: Error in setup(): "TypeError: Cannot read property 'count' of undefined"

found in

---> <Counter> at src/components/Counter.vue
       <App> at src/App.vue
         <Root>

The state is declared as follows:

setup() {
    const state = reactive({
      count: 0,
      double: computed(() => state.count * 2)
    })
   //...
}

Am i doing something wrong or is this not supported yet in the plugin?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions