<script setup>
import { onMounted, onUpdated, reactive,ref } from 'vue';
 const obj=reactive({
  name:'kjp'
 })
 const ha=ref(6)
console.log('22222')
defineProps({
  msg: {
    type: String,
    required: true
  }
})
function edit(){
  obj.name='ppppp'
  ha.value=77
}
onMounted(()=>{
console.log('555555')
console.log(ha.value)

})
onUpdated(()=>{
  console.log()
})
</script>

<template>
  <div class="greetings">
    <h1 class="green">{{ msg }}</h1>
    <h3>
      You’ve successfully created a project with
      <a target="_blank" href="https://vitejs.dev/">Vite</a> +
      <a target="_blank" href="https://vuejs.org/">Vue 3</a>.
    </h3>
    <h2>姓名：{{ obj.name }}</h2>年龄：{{ ha }}
    <button @click='edit'>修改名字</button>
  </div>
</template>

<style scoped>
h1 {
  font-weight: 500;
  font-size: 2.6rem;
  top: -10px;
}

h3 {
  font-size: 1.2rem;
}

.greetings h1,
.greetings h3 {
  text-align: center;
}

@media (min-width: 1024px) {
  .greetings h1,
  .greetings h3 {
    text-align: left;
  }
}
</style>
