Tarjima qoshish uchun havola boyicha o'tib Pull Request oching (havolaga o'tish).
Standart til uchun tarkibni ko'rsatadi.
Creates a Gate to consume data from view, designed for Vue 3. If defaultState is defined, Gate.state will be created with passed value.
createGate introduced in effector-vue 21.1.0
Methods
createGate(config?: {defaultState?, domain?, name?})
Arguments
config (Object): Optional configuration object
defaultState?: Optional default state for Gate.statedomain?(Domain): Optional domain which will be used to create gate units (Gate.open event, Gate.state store, and so on)name?(string): Optional name which will be used as the name of a created Vue component
Returns
Examples
Basic Usage
import { createGate } from "effector-vue/composition";
export const ListGate = createGate<string>({ name: "Gate with required props",});
ListGate.state.watch((state) => { console.log("current state", state);});// => current state null<script setup lang="ts">import { useGate } from "effector-vue/composition";
import { ListGate } from "./model";
const props = defineProps<{ id: string }>();
useGate(ListGate, () => props.id);</script>
<template> <div>{{ id }}</div></template><script setup lang="ts">import { ref } from "vue";
import ListItem from "./ListItem.vue";
const id = ref("1");</script>
<template> <ListItem :id="id" /></template>import { createApp } from "vue";
import App from "./App.vue";
const app = createApp(App);
app.mount("#app");// => current state 1
app.unmount();// => current state nullThe gate opens on mount with the props it has at that moment and closes on unmount. useGate describes the order of open and set, the behavior under <KeepAlive> and on the server.
Ingliz tilidagi hujjatlar eng dolzarb hisoblanadi, chunki u effector guruhi tomonidan yozilgan va yangilanadi. Hujjatlarni boshqa tillarga tarjima qilish jamiyat tomonidan kuch va istaklar mavjud bo'lganda amalga oshiriladi.
Esda tutingki, tarjima qilingan maqolalar yangilanmasligi mumkin, shuning uchun eng aniq va dolzarb ma'lumot uchun hujjatlarning asl inglizcha versiyasidan foydalanishni tavsiya etamiz.