the vue sibling component passes a value, but when receiving the value, there is a problem with the this pointing?
a.vue
import Bus from "../../utils/bus.js" //vue
export default {
components: {
baidumap,
bmView
},
data () {
return {
zoom: 10,
address: ""
}
},
mounted () {
this.createdMap();
let that = this;
Bus.$on("addValue",function (argument) {
console.log(that)
if (argument) {
that.address = argument.ci_name
console.log(that)
}
})
console.log(this)
console.log(that)
}
}
b.vue
import Bus from "../../utils/bus.js"
export default {
data () {
return {
proshow:true,
cityshow:false,
countyshow:false,
townshow:false,
proArr: [],
cityArr: [],
countyArr: [],
townArr: []
}
},
methods: {
selectpro (item) {
if (item.ci_id == 36) {
Bus.$emit("addValue",item)
this.$router.go(-1);
return;
}
}
}
}
the this output in a.vue points to
][2]][1]
bus.js vue
Why is it that their _ uid is different and the address data has been changed in the instance with _ uid of 3 and the address data has not changed in the instance with the uid of 50?