Maintenance vue + element of old projects recently, there is a dialog component needs to reuse in another page, and there is no link these two pages, relatively large data method is more, stupid way is to copy one by one, but it is easy to out of the question, how can I make it easier?
CodePudding user response:
What do you mean that the components used in a page, and interaction with the page have a lot of data, and now you want to put this component to another page, as well as bring data also is used in the past
CodePudding user response:
reference 1st floor Lpyexplore response: what do you mean this component originally used in a page, and interaction with the page have a lot of data, and now you want to put this component to another page, but also bring data also is used in the past? right, sorrow is dead, this is the demand of the product, feeling a bald CodePudding user response:
With the event bus, very simple, the data package to events on the bus, then on that page to monitor the events on the bus, and data CodePudding user response:
reference Lpyexplore reply: 3/f with the event bus, very simple, the data package to the event on the bus, then on that page to monitor the events on the bus and the data is good event bus? Is the event center must mean? I baidu is also under the eventBus, zha with ah bosses CodePudding user response:
You turn a blog and have a look, I have a talk about the event bus, if you will direct messages I look not to understand, to help you CodePudding user response:
reference Lpyexplore reply: 3/f with the event bus, very simple, the data package to the event on the bus, then on that page to monitor the events on the bus and the data is good I had have to mean is this: one page A, page one of A dialog, the dialog in A page contains dozens of data; There is now a page B, need to use the dialog, and I can think of the most stupid way is to copy the components in the past, then data change, little by little, CodePudding user response:
reference 5 floor Lpyexplore reply: I have a blog and have a look, you have talked about the event bus, if you will direct messages I look not to understand, to help you yeah yeah right CodePudding user response:
Try to register the components to the global is not can be used in any page? The import dialog from '../dialog ' Vue.com ponent (' my - dialog, the dialog) Use the CodePudding user response:
refer to April 6th floor also like earth. Response: Quote: refer to the third floor Lpyexplore response: With the event bus, very simple, the data package to the event on the bus, then on that page to monitor the events on the bus and the data is good originally get what I mean is this: one page A, page one of A dialog, the dialog in A page contains dozens of data; There is now A page B, need to use the dialog, and I can think of the most stupid way is to copy the components in the past, then data change, little by little, yes, is to use an event bus line, actually not event bus you can use common parent-child communication component, A component for C, C, in A father of A is C components, now want to use B, C that B is the father of C components, common parent-child components communication can also complete the features you want CodePudding user response:
reference jio can reply on the eighth floor: try to register the components to the global is not can be used in any page? The import dialog from '../dialog ' Vue.com ponent (' my - dialog, the dialog) Use the but this component is not independent, but with the current page in the current page data confusion together, how can I register for the individual components CodePudding user response:
references 9 f Lpyexplore response: Quote: refer to April 6th floor also like earth. Response: Quote: refer to the third floor Lpyexplore response: With the event bus, very simple, the data package to the event on the bus, then on that page to monitor the events on the bus and the data is good originally get what I mean is this: one page A, page one of A dialog, the dialog in A page contains dozens of data; There is now A page B, need to use the dialog, and I can think of the most stupid way is to copy the components in the past, then data change, little by little, yes, is to use an event bus line, actually not event bus you can use common parent-child communication component, A component for C, C, in A father of A is C components, now want to use B, C that B is the father of C components, common parent-child communication components can also complete the functionality you want but C is not in A separate, but with A try, how can I alone CodePudding user response:
Don't try to pull away, alone, and this how out of component must use other page data interaction, you can only in this way, otherwise, you can use vuex CodePudding user response:
refer to 12 floor Lpyexplore reply: don't pull away alone,,, this how to pull away the component must use other page data interaction, you can only in this way, otherwise you'll use vuex that can only be appointed, copying out bit by bit,,,