<template>
  <view class="some-one">
    WHO AM I?
    <view> I AM {{name}}</view>
  </view>
</template>

<script>

export default {
  props: {},
  data: () => ({
    name:''
  }),
  computed: {},
  methods: {
    nameCallback(name){
      console.log(`nameCallback name = ${name}`);
      this.name = name
    }
  },
  watch: {},
  created(){
    uni.$on("updateName",this.nameCallback)
  },

  // 组件周期函数--监听组件挂载完毕
  mounted() {},

  // 组件周期函数--监听组件激活(显示)
  activated() {},
  // 组件周期函数--监听组件停用(隐藏)
  deactivated() {},
  // 组件周期函数--监听组件销毁之前
  beforeDestroy() {
    uni.$off("updateName",this.nameCallback)
  },
};
</script>

<style></style>
