Warning: preg_grep(): Compilation failed: quantifier does not follow a repeatable item at offset 27 in /var/www/tg-me/post.php on line 75
Frontend | Вопросы собесов | Telegram Webview: easy_javascript_ru/1390 -
Telegram Group & Telegram Channel
🤔 В какой последователности будут вызываться хуки при использовании хуков жизненного цикла в миксине и подключении его в компонент?

В Vue 2 и Vue 3 можно подключать миксины (mixins), которые добавляют в компонент дополнительные методы, данные и хуки жизненного цикла.

🚩Пример в Vue 2

Миксин (myMixin.js)
export default {
created() {
console.log("🌍 Миксин: created");
}
};


Компонент (MyComponent.vue)
<script>
import myMixin from "./myMixin.js";

export default {
mixins: [myMixin],
created() {
console.log("📦 Компонент: created");
}
};
</script>


Вывод в консоль при создании компонента
Миксин: created
Компонент: created


Vue 3: хуки вызываются так же
Если использовать setup(), он выполнится после хуков миксина
import { onMounted } from "vue";
export default {
mixins: [myMixin],
setup() {
console.log("🚀 setup()");
},
mounted() {
console.log("📦 Компонент: mounted");
}
};


Вывод в консоль
Миксин: mounted
setup()
Компонент: mounted


Ставь 👍 и забирай 📚 Базу знаний
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/easy_javascript_ru/1390
Create:
Last Update:

🤔 В какой последователности будут вызываться хуки при использовании хуков жизненного цикла в миксине и подключении его в компонент?

В Vue 2 и Vue 3 можно подключать миксины (mixins), которые добавляют в компонент дополнительные методы, данные и хуки жизненного цикла.

🚩Пример в Vue 2

Миксин (myMixin.js)

export default {
created() {
console.log("🌍 Миксин: created");
}
};


Компонент (MyComponent.vue)
<script>
import myMixin from "./myMixin.js";

export default {
mixins: [myMixin],
created() {
console.log("📦 Компонент: created");
}
};
</script>


Вывод в консоль при создании компонента
Миксин: created
Компонент: created


Vue 3: хуки вызываются так же
Если использовать setup(), он выполнится после хуков миксина
import { onMounted } from "vue";
export default {
mixins: [myMixin],
setup() {
console.log("🚀 setup()");
},
mounted() {
console.log("📦 Компонент: mounted");
}
};


Вывод в консоль
Миксин: mounted
setup()
Компонент: mounted


Ставь 👍 и забирай 📚 Базу знаний

BY Frontend | Вопросы собесов


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/easy_javascript_ru/1390

View MORE
Open in Telegram


Frontend | Вопросы собесов Telegram | DID YOU KNOW?

Date: |

Telegram Be The Next Best SPAC

I have no inside knowledge of a potential stock listing of the popular anti-Whatsapp messaging app, Telegram. But I know this much, judging by most people I talk to, especially crypto investors, if Telegram ever went public, people would gobble it up. I know I would. I’m waiting for it. So is Sergei Sergienko, who claims he owns $800,000 of Telegram’s pre-initial coin offering (ICO) tokens. “If Telegram does a SPAC IPO, there would be demand for this issue. It would probably outstrip the interest we saw during the ICO. Why? Because as of right now Telegram looks like a liberal application that can accept anyone - right after WhatsApp and others have turn on the censorship,” he says.

Can I mute a Telegram group?

In recent times, Telegram has gained a lot of popularity because of the controversy over WhatsApp’s new privacy policy. In January 2021, Telegram was the most downloaded app worldwide and crossed 500 million monthly active users. And with so many active users on the app, people might get messages in bulk from a group or a channel that can be a little irritating. So to get rid of the same, you can mute groups, chats, and channels on Telegram just like WhatsApp. You can mute notifications for one hour, eight hours, or two days, or you can disable notifications forever.

Frontend | Вопросы собесов from us


Telegram Frontend | Вопросы собесов
FROM USA