How do I reuse Vue components?
The component emits the event, the parent subscribes to it by assigning its own handler. Thus, in each specific case, the handlers can be different and the same component becomes universal. See example:
Pass to the component as props a function that should be called when the button is pressed / the line is edited.
Instead of directly writing to the component, you can raise an event, and handle it at the place where the component is inserted.Anonymous
To place the code, please use CodePen or similar tool. Thanks you!