Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

vue dynamic component props

//--- html
<component 
    v-for="(comp, index) in dynamic" 
    :key="index"
    :is="comp.component" 
  	v-bind="{...comp.props}" />


//--- script vue
import component1 from 'component1';
import component2 from 'component2';

export default {
	components: {
      component1,
      component2
    },
	data(){
		return {
    		dynamic: [
            	{ 
                	component: 'component1',
                    props: {foo: bar, ...}
             	},
                { 
                	component: 'component2',
                    props: {foo: bar, ...}
             	},
         	]
    	}
	}
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript console log execution time 
Javascript :: test if multiple checkboxes are checked jquery 
Javascript :: relaod the page in express 
Javascript :: javascript undefined check 
Javascript :: install node js 14 
Javascript :: javascript play audio 
Javascript :: how to import your external js 
Javascript :: node command line input 
Javascript :: statusbar reactnati 
Javascript :: vue.js textbox 
Javascript :: javascript get first property of object 
Javascript :: angular serve 
Javascript :: get month in two digit in javascript date 
Javascript :: react native text span 
Javascript :: linear gradient reactjs 
Javascript :: write to console using jQuery 
Javascript :: get form data serialize jquery 
Javascript :: local storal javascript 
Javascript :: using aria attributes in angular 
Javascript :: append to array js 
Javascript :: queryselector a tag with text 
Javascript :: js insert emoji 
Javascript :: queryselector 
Javascript :: javascript date time 
Javascript :: Unable to locate package node 
Javascript :: datatable giving default width to colums 
Javascript :: run a code after delay js 
Javascript :: convert json result to datatable c# 
Javascript :: getboundingclientrect() javascript 
Javascript :: Checking Empty JS Object 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =