<template>
  <div class="demo8">
    <h2 ref="address">北京</h2>
    <button @click="getAddress">获取地址</button>
  </div>
</template>

<script lang="ts" setup name="Demo8">
import {ref} from 'vue'
import { defineExpose } from 'vue';
let address = ref();
let a = ref(1);
let b = ref(2);
let c = ref(3);
function getAddress() {
    console.log(address.value,'demo8')
}
// 抛出父组件允许获取的值 
defineExpose({a,b,c,address})
</script>

<style></style>
