Known, subassemblies, assemblies get the parent pass over the data by props, and this data can not be used in created, it mounted the life cycle, only to get in beforeUpdated or Updated ;
But if we want to use this data and then obtain additional data and render the page , we can not operate in beforeUpdated or updated, self-contradictory.
This method can be used in the Vue watch, listen first subassembly acquired data, when there is change data (that is, after acquiring the data to), and then call the appropriate method.
Below, detail the data obtained subassembly, and then to use this data in getTicket method, it is necessary to watch the monitor changes in detail, when the detail data, then call getTicket method, data used in the process
props: {
detail: ''
},
methods: {
async getTicket () {
console(this.detail)
}
},
watch: {
detail () {
this.getTicket()
}
}