vue3 watch监听单个数据变化

<template>
  <input type="text" v-model="message">
</template>
<script setup lang="ts">


import {ref, watch} from "vue";

let message = ref<string>("小满")
watch(message, (newVal, oldVal) => {
  console.log(newVal, oldVal)
})
</script>

猜你喜欢

转载自blog.csdn.net/mp624183768/article/details/128739403