1、通过 $ref 获取

主父组件中:
<x-test  ref="ch"></x-test>
import XTest from '@/components/x-test/x-test'
export default {
  mounted() {
    console.log(this.$refs.ch.searchProduct)
  },
  components: {
    XTest
  }
}
在子组件中:
export default {
  data () {
    return {
      searchProduct: '小米'
    }
  }
}

 

 

 

相关文章:

  • 2022-12-23
  • 2021-07-21
  • 2022-12-23
  • 2021-10-23
  • 2022-01-23
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-03
  • 2022-02-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案