Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

vue mount modal to body

// If you're really, really desperate:

// 1. In your root Vue instance
new Vue({ data() { return { currentModal: null } } });
// 2. Bind the component in the template
<body id='app'>
    <component v-if="currentModal" :is="currentModal"></component>
    ...
</body>
// 3. Render anything you want programmatically from other components
// Inside every component you have access to the root instance with this.$root.
this.$root.currentModal = 'my-component'

// You might want to add another prop like `currentModalProps` to pass data to it.
// Not easy to get data back from the component I think.
// This is a Hail Mary attempt to get this working.
Comment

PREVIOUS NEXT
Code Example
Javascript :: the document has mutated since the result was returned 
Javascript :: check change from service variable angular 
Javascript :: how to choose a weighted random array element in javascript 
Javascript :: javascript show alert if browser is not google chrome 
Javascript :: bootstrap 5 
Javascript :: how to print in html 
Javascript :: format numbers js 
Javascript :: how to declare a variable js 
Javascript :: disable input field javascript 
Javascript :: react router browser refresh 
Javascript :: react time picker 
Javascript :: localstorage in next js 
Javascript :: react-scripts not found 
Javascript :: switch case 
Javascript :: values javascript 
Javascript :: object length 
Javascript :: how to use the javascript console 
Javascript :: name function in javascript 
Javascript :: install tailwind css with next js 
Javascript :: javascript how to select a array 
Javascript :: how to use break in javascript 
Javascript :: api integration for web pages in next js 
Javascript :: Default Parameter Values in javascript 
Javascript :: react -native-config 
Javascript :: random password generator javascript 
Javascript :: how to add a function in javascript 
Javascript :: electron install 
Javascript :: amazon s3 upload error ssl certificate 
Javascript :: express delete session variable 
Javascript :: set twig variable from javascript 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =