Vue3 双向绑定文本框并设置内容 - 使用 Script Setup 和函数
<template>
<div>
<input type='text' v-model='text'>
<button @click='setText'>设置为123</button>
</div>
</template>
<script setup>
import { ref } from 'vue'
const text = ref('')
function setText() {
text.value = '123'
}
</script>
原文地址: https://www.cveoy.top/t/topic/mzWQ 著作权归作者所有。请勿转载和采集!