Props

Other topics

VueJS 2 props example

JavaScript:

Vue.component('props-component', {
    template: '#props-component-template',
    // array of all props
    props: ['myprop', 'calcprop']
});


new Vue({
    el: '#app'
});

HTML:

<div id="app">
    <template id="props-component-template">
        <div>Props: {{myprop}} - {{calcprop}}</div>
    </template>

    <props-component 
        myprop="prop_value" 
        :calcprop="Math.random()">
    </props-component>
</div>

Contributors

Topic Id: 10123

Example Ids: 31063

This site is not affiliated with any of the contributors.