Sobes.tech

Frontend

setup() (setuppan əvvəl beforeCreate və created işləyir) onBeforeMount onMounted onBeforeUpdate onUpdated onBeforeUnmount onUnmounted Val: setup Val: beforeCreate Val: created Val: beforeMount Uşaq: setup Uşaq: beforeCreate Uşaq: created Uşaq: beforeMount Uşaq: mounted Val: mounted <template> <button @click="onClick"> {{ text }} </button> </template> <script lang="ts"> interface Props { text: string; } const props = defineProps<Props>(); interface Emit { myClick: [string]; } const emits = defineEmit<Emit>(); function onClick() { } </script> <template> <MyButton :text="Beni tıkla"></MyButton> </template>

191

// comp.vue <template> <ul v-if="products != null"> <li v-for="(pr, i) in products">{{pr}}</li> </ul> </template> <script> import {getProducts} from ""; import {ref} from "vue"; const products = ref(null); onMounted(() => { getProducts().then(result => products.value = result) }) </script> setup() (boshqa yaratishdan oldin va createddan oldin bajariladi) onBeforeMount onMounted onBeforeUpdate onUpdated onBeforeUnmount onUnmounted Ota: setup Ota: beforeCreate Ota: created Ota: beforeMount Ota: mounted Farzand: setup Farzand: beforeCreate Farzand: created Farzand: beforeMount Farzand: mounted Ota: mounted <template> <div> <slot name=""></slot> </div> </template>

175

const hadisələr = [ { ad: 'Маша', tarix: '[phone]' }, { ad: 'Даша', tarix: '[phone]' }, { ad: 'Ваня', tarix: '[phone]' }, { ad: 'Петя', tarix: '[phone]' }, { ad: 'Митя', tarix: '[phone]' }, ];

151
/2