During the learning process, I encountered the problem of how to communicate between different components. Here are some methods of sorting out.
1. Passing values between two (not close) components:
There is no father-son relationship between the two. Is brotherhood or unrelated
// A向B传值
uni.navigateTo({ url: './editTechnology?type=' + this.type })
// B向A传值
let pages = getCurrentPages()
let prevPage = pages[pages.length - 2]
prevPage.$vm.isUpdate = true // 需要传的值是isUpdate
setTimeout(() => {
uni.navigateBack({})
}, 500)
The above are some methods of passing values between different components.