<script setup>
/**
 * name：子父组件通信 父组件
 * user：sa0ChunLuyu
 * date：2022-04-13 11:14:00
 */
import SonComponent from './components/Son.vue'

const fa_value = ref('fa_value')
const son_ref = ref(false)
const SonRef = (e) => {
  son_ref.value = e
}
const faFunc = () => {
  console.log('faFunc')
}
</script>
<template>
  <tr>
    <td rowspan="2">子父组件通信</td>
    <td>
      <n-input v-model:value="fa_value"></n-input>
      <n-input mt-1 v-model:value="son_ref.son_value"></n-input>
    </td>
    <td>
      <n-button secondary strong @click="son_ref.sonFunc()">
        子函数
      </n-button>
    </td>
  </tr>
  <SonComponent @faFunc="faFunc" :fa_value="fa_value" :ref="SonRef"></SonComponent>
</template>
