<template>
  <div>
    <div>Counter-{{ counter }}</div>
    <Button @click="inc()" type="primary">inc</Button>
    <Button @click="dec()" type="primary">dec</Button>
  </div>
</template>

<script>
import store from '@t-design/store';
import model from './model';

store.model(model);

export default {
  name: 'TdFunnelChart',
  componentName: 'TdFunnelChart',
  components: {},
  data() {
    return { counter: 0 };
  },
  mounted() {
    this.$subscribeTo(this.$store.stream('funnelChart'), v => {
      this.counter = v.counter;
    });
  },
  methods: {
    inc() {
      this.$store.dispatch({ type: 'funnelChart/inc' });
    },
    dec() {
      this.$store.dispatch({ type: 'funnelChart/dec' });
    },
  },
};
</script>
