How to implement attribute event transfer in vue
This article is about how vue implements property event delivery. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Attribute event transfer
Children's shoes that have written about high-level components may encounter the situation of passing the processed attributes downwards. If you encounter more attributes, you need to pass them one by one, which is very unfriendly and time-consuming. Is there any one-time transmission (such as {. This.props} in react)? The answers are v-bind and v-on.
For example, if there is a basic component BaseList, only the basic list display function, now we want to add sorting function on this basis, at this time we can create a high-level component SortList.
Import BaseList from ". / BaseList"; / / contains the basic attribute definition import BaseListMixin from ". / BaseListMixin"; / / encapsulates the sorting logic import sort from ". / sort.js"; export default {props: BaseListMixin.props,components: {BaseList}}
You can see the convenience of passing properties and events instead of passing them one by one
Thank you for reading! This is the end of this article on "how to achieve attribute event delivery in vue". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!