@tetragius/raxy-vue
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

npm version

Подробное описание

Демонстрация

API

Raxy

./store

import { createConnector, connectDevTools, logger } from "@tetragius/raxy";

const initState = { countA: 1, countB: 3 };

export const instanse = createConnector(initState);

connectDevTools(instanse);
logger(instanse.subscribe);

index.js

import Vue from "vue";
import App from "./App.vue";
import Raxy from "@tetragius/raxy-vue";
import { instanse } from "./store";

Vue.config.productionTip = false;

Vue.use(Raxy); // Connecting Raxy

new Vue({
  raxy: instanse, // Pass the IRaxy instance
  render: (h) => h(App)
}).$mount("#app");

Component A

<template>
  <div>
    <h3>Counter A</h3>
    <p>{{ countA }}</p>
  </div>
</template>

<script>
export default {
  data: () => ({
    countA: 0,
  }),
  beforeCreate() {
    this.$raxy.filter = (store) => ({ // A function that determines when to update a component
      countA: store.countA,
    });
  },
};
</script>
<template>
  <div>
    <button @click="incrementA">increment A</button>
    <button @click="incrementB">increment B</button>
  </div>
</template>

<script>
export default {
  methods: {
    incrementA() {
      this.$raxy.store.countA = this.$raxy.store.countA + 1; // Updating the store value
    },
    incrementB() {
      this.$raxy.store.countB = this.$raxy.store.countB + 1;
    },
  },
};
</script>

Readme

Keywords

Package Sidebar

Install

npm i @tetragius/raxy-vue

Weekly Downloads

10

Version

1.0.7

License

MIT

Unpacked Size

4.08 kB

Total Files

5

Last publish

Collaborators

  • mr.tetragius