ComponentOptions (Vue2)

effector

Returns

(Function | Object | Store): Store or object of Store’s, or function which will be called with the Component instance as this.

Examples

Basic Usage

import Vue from "vue";
import { createStore, combine } from "effector";

const counter = createStore(0);

new Vue({
  data() {
    return {
      foo: "bar",
    };
  },
  effector() {
    // would create `state` in template
    return combine(
      this.$store(() => this.foo),
      counter,
      (foo, counter) => `${foo} + ${counter}`,
    );
  },
});

Using Object Syntax

import { counter } from "./stores";

new Vue({
  effector: {
    counter, // would create `counter` in template
  },
});

Using Store Directly

import { counter } from "./stores";

new Vue({
  effector: counter, // would create `state` in template
});
Contributors