1、ref标签
<template>
<div class = "person">
<h1>China</h1>
<h1>beijing</h1>
<button @click="showLog">点击此处输出中文</button>
</div>
</template>
<script lang = "ts">
export default{
name: "Person",
setup(){
function showLog(){
console.log("中国,北京");
}
return {
showLog
}
}
}
</script>
<style>
div.person{
margin: 50px;
}
</style>