Sobes.tech

Frontend

setup() (o'tkaziladi oldin beforeCreate va created) onBeforeMount onMounted onBeforeUpdate onUpdated onBeforeUnmount onUnmounted Ota: setup Ota: beforeCreate Ota: created Ota: beforeMount Bolalar: setup Bolalar: beforeCreate Bolalar: created Bolalar: beforeMount Bolalar: mounted Ota: 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="Mua meni"></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 Farzand: setup Farzand: beforeCreate Farzand: created Farzand: beforeMount Farzand: mounted Ota: mounted <template> <div> <slot name=""></slot> </div> </template>

175

const events = [ { name: 'Маша', date: '[phone]' }, { name: 'Даша', date: '[phone]' }, { name: 'Ваня', date: '[phone]' }, { name: 'Петя', date: '[phone]' }, { name: 'Митя', date: '[phone]' }, ];

151
/2