跳到主要内容

createComponent(componentOptions, store?)

Arguments

  1. componentOptions (Object): component options ( hooks, methods, computed properties )
  2. store (Object): Store object from effector

Returns

(vue component)

Example

<template>
{{ $counter }}
</template>
// component.vue
import {createComponent} from 'effector-vue'

const $counter = createStore(0)
const {update} = createApi($counter, {
update: (_, value: number) => value,
})

export default createComponent(
{
name: 'Counter',

methods: {
update,
handleClick() {
const value = this.$counter + 1 // this.$counter <- number ( typescript tips )
this.update(value)
},
},
},
{$counter},
)