Whether it is possible to mount a vue component to multiple dom #13161
              
                Unanswered
              
          
                  
                    
                      eric-gitta-moore
                    
                  
                
                  asked this question in
                Help/Questions
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
I tried an operation that allows a single instance component to mount on multiple dom pages
The beginning of thinking:
Vue SFC Playground
I hope to achieve something like this:
<Teleport :to="['#id1', '#id2']" />I tried using
createVNode,renderto try to do something, but it seemed endless and didn't change anything.Vue SFC Playground
During the process, I discovered a fact that every time the DOM is rendered, the click listener within it is already bound to the onClick function in the setup closure, and it seems there is no way to change this (unless you manually bind the corresponding event listener from
#demo1to#demo2and remove the original listener).Beta Was this translation helpful? Give feedback.
All reactions