Keep Vue From Replacing Mounting Element's Inner Content #12788
Unanswered
KyleMo
asked this question in
Help/Questions
Replies: 1 comment 1 reply
-
Have you tried removing the template option?
https://vuejs.org/guide/essentials/application.html#in-dom-root-component-template |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem: When mounting the app on an element all of said element's children are removed by Vue and replaced by the template provided. This occurs even if no template is provided (resulting in nothing appearing). This is NOT the behavior my team wants.
I'll start by saying I'm new to Vue. We prerender and serve the page's HTML immediately via .Net Razor Pages. Within the prerendered HTML document we add in the expected Vue functions that are loaded in via CDN to the browser. Once Vue loads in, it is then mounted to the appropriate element and all the prerender HTML gains functionality and doesn't remove any children elements.
It has been my task to try and update to Vue 3, implement typescript, and hopefully start using the newer .vue format. Getting all this to transpile and work has been a pain, but now all the work has been essentially made pointless because Vue overrides all inner content of the mounting element and we simply cannot accept this behavior. I've tried many different things to fix this. Any ideas would be appreciated.
Here is some code to get an idea of what we are doing
login.cshtml file (the EXTRA BUTTON always get removed)
The logic that gets added into the bundle.js file (pulling from a CDN caused more issues so trying to just use npm package of vue)
And the Login.vue file
Beta Was this translation helpful? Give feedback.
All reactions