Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

Metronic components not working in Vue Router


Hi, I've followed this guide to integrate Metronic 9 with Vuejs. I'm running Vue router so, as mentioned in the guide, I'm initializing KTComponent like this:

// index.ts
import KTComponent from '../metronic/core/index.ts;
import KTLayout from '../metronic/app/layouts/demo1.js';

router.beforeEach(() => {
KTComponent.init();
KTLayout.init();
});


However, when I try running a component inside a view it doesn't work. When I paste a tooltip inside a view, for example:

<button class="btn btn-primary" data-tooltip="#default_tooltip">
Toggle Tooltop
</button>
<div class="tooltip" id="default_tooltip">
Hey, a delightful tooltip is here!
</div>


It doesn't work. But if I initialize the component like this it works:


import KTTooltip from '../metronic/core/index.ts';
KTTooltip.init()


There must be an issue in the way components are getting initialized inside KTComponent.


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (5)


@slither io what do you think about this case



Hi,

Thank you for the heads-up. We will check it further and get back to you shortly.

Regards.



Hey! Any updates on the above?



Hi,

Sorry for the late reply.

May I know which version you are using? Have you checked it with the latest Metronic v9.0.3 ?

We have also updated the React Integration Guide and React Starterkit as well.

Regards,
Sean


Hi,

Sorry for the late reply.

We have tried using our tooltip component on react-router page and tooltips get initialized correctly.

Do you still have the KTTooltip.init() trigger in the function KTComponent.init()?

Are you getting any errors in your browser console?

Regards, Lauris Stepanovs, Keenthemes Support Team

Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(