Vue.extend( options )
-
Arguments:
{Object} options
-
Usage:
Create a “subclass” of the base Vue constructor. The argument should be an object containing component options.
The special cases to note here are
el
anddata
options - they must be functions when used withVue.extend()
.<div id="mount-point"></div>
// create reusable constructor var Profile = Vue.extend({ template: '<p>{{firstName}} {{lastName}} aka {{alias}}</p>' }) // create an instance of Profile var profile = new Profile({ data: { firstName: 'Walter', lastName: 'White', alias: 'Heisenberg' } }) // mount it on an element profile.$mount('#mount-point')
Will result in:
<p>Walter White aka Heisenberg</p>
-
See also: Components
Please login to continue.