Updating component registration error
Example: , your component configuration object can have arbitrary other properties.
That’s why components can accept arbitrary attributes, which are added to the component’s root element. We have learned that the parent can pass data down to the child using props, but how do we communicate back to the parent when something happens? Every Vue instance implements an events interface, which means it can: In this example, it’s important to note that the child component is still completely decoupled from what happens outside of it.
All it does is report information about its own activity, just in case a parent component might care.
A non-prop attribute is an attribute that is passed to a component, but does not have a corresponding prop defined.
While explicitly defined props are preferred for passing information to a child component, authors of component libraries can’t always foresee the contexts in which their components might be used.
Example: This is mainly useful when you’re fetching the markup from somewhere programmatically (e.g., AMD - see below), or as a build system output that packages components for distribution, since it’s not very convenient to manually edit HTML as a Java Script string literal.
If you’re building configurations programmatically and you have an array of DOM nodes, you can use them as a component template: In this case, all the specified nodes (and their descendants) will be cloned and concatenated into each copy of the component that gets instantiated.
This is convenient, however it leads to maintenance issues in the long run because it breaks the one-way data flow assumption: the code that mutates child props are implicitly affecting parent state.
This is why we removed the modifier when 2.0 was released.
For a complete example, see passing markup into components.