KTComponents.init() not working on SPA
hello, I'm just learning front end design. I encountered problems when integrating the metronic 8 template which is Backend Console with my Vue project. I have added KTComponents.init(); onMounted on each of my pages, but when moving to a new page some components don't work, for example the search bar.
Replies (3)
In react, Use :
useEffect(() => {
if (KTComponents && KTComponents.init) {
KTComponents.init();
}
}, []);
Hi,
Thank you for reaching out to us.
KTComponents.init() contains initialization for primary global components. However, it doesn't include initialization for KTSearch component, you can find examples of how to use KTSearch in js/custom/apps/subscriptions/add/customer-select.js and our documentation https://preview.keenthemes.com/html/metronic/docs/general/search.
Regards,
Lauris Stepanovs,
Keenthemes Support Team
div class="m-0">
<div class="d-flex mb-10">
<div
class="d-flex align-items-center w-lg-400px"
data-kt-search-keypress="true"
data-kt-search-min-length="2"
data-kt-search-enter="enter"
data-kt-search-layout="menu"
data-kt-menu-trigger="auto"
data-kt-menu-permanent="true"
data-kt-menu-placement="bottom-start"
data-kt-menu-flip="bottom"
data-kt-search="true"
>
This quick search cannot be initiated