Bind @ click= "add" in app.vue to define the logic of the add method on other pages

problem description

I wrote some structures as public parts in app.vue . One of the buttons (this button is the public part, which is used by many pages) is bound to @ click= "add", and then this button in the public part is used on the home page and other pages, and each page needs to define the logic of the add () method that clicks this button separately. What should I do?


< H2 > solution < / H2 >
1. Define ref in router-view first
  

it is recommended to start with vue componentization, extract the structure you are talking about into a component, and introduce
with parent-child component emit on different pages to implement-> each page defines the add () method for clicking this button separately

Menu