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

Double Menu Wrapper - Vue js


Iam using vue js template and there is a bug: after login its creating the "Menu wrapper" 2-times - so the Navbar is doubled. Any suggestions how to fix this?


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 (3)


Hi Johannes,

Thank you for pointing us to this problem.

We will include a fix for it in the next Metronic release. For now, as a temporary solution, you can replace the update function with the code below in src/assets/ts/components/_SwapperComponent.ts.


public update = () => {
const parentSelector = this.getOption("parent")?.toString();
const mode = this.getOption("mode");
const parentElement = parentSelector
? document.querySelector(parentSelector)
: null;
if (parentElement && this.element.parentNode !== parentElement) {
const alreadyPended = document.getElementById("kt_header_menu") !== null;
if (!alreadyPended) {
const childEl = (parentElement as HTMLElement).querySelector("[data-kt-swapper="true"]");
childEl?.remove();
if (mode === "prepend") {
parentElement.prepend(this.element);
} else if (mode === "append") {
parentElement.append(this.element);
}
}
}
}


Let us know if you have any further questions on this topic or anything else.

Regards,
Lauris Stepanovs,
Keenthemes Support Team



Thanks a lot!
I just changed the double-quotes, then your provided code worked perfectly!

But i think this just a bug from this Website and you provided it correctly:
const childEl = (parentElement as HTMLElement).querySelector('[data-kt-swapper="true"]');

And with pre it creates the double quotes



const childEl = (parentElement as HTMLElement).querySelector("[data-kt-swapper="true"]");



Hi Johannes,

Glad to hear it worked for you.
Oh yes, it is a problem with our code preview component, you should use a single quote for the selector string.

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  :(