componentsoption of the parent component. Custom components declared like this can be used just like built-in components.
Vue.component()in the main script of the application:
propssection specifies that this component has two properties,
Objectto validate the property.
v-binddirective even if you pass a constant value. Otherwise the value would be interpreted as a string. For example:
trueto a boolean property:
valueproperty, because that will not automatically update the data in the parent component.
v-modeldirective can also be used with custom components. By default, it binds the
valueproperty and the
inputevent to the specified property of the parent component, so the above code is equivalent to:
<slot>element. The slot contents can include not just text, but also other elements, including built-in components and custom components.
<component>element can be used to dynamically switch between components. For example, you can replace the entire contents of a window without having to close it and create a new window:
currentComponentproperty can contain either the name of a registered component, or the options object which defines a component.