Vue component reuse, how to request different interfaces according to different router?

there are many places in project development where the module content is the same or highly similar, but the routing source is different, how to use different interfaces in the component when using the component? Or pass different values to the same interface?
what I"m doing now is this:
make a judgment based on $route.name in mounted, request different interfaces according to different sources, or pass different values to different interfaces, which can also achieve the desired results, but it doesn"t always feel very good. Does the god have a better way?

Mar.06,2021

personally, I think you should first count the commonness and heterosexuality of the interfaces of all your shared components. The commonness is written in the component, and the heterosexual one is passed through the parent component using prop, for example:

< H2 > supplementary answer < / H2 >
  

personally, I think it is unrealistic to use router to pass parameters params or query, splicing request address to ok, if the component is deconstructed with only one layer of props implementation

Menu