<template>
<view>
<form @submit="onSubmit">
<input type="text" v-model="formData.title" placeholder="请输入标题" />
<input type="text" v-model="formData.desc" placeholder="请输入摘要" />
<button type="submit">提交</button>
</form>
</view>
</template>
<script setup>
import { ref } from 'vue';
const formData = ref({
title: '',
desc: ''
});
const onSubmit = (event) => {
event.preventDefault();
console.log(formData.value);
};
</script>
uniapp vue3获取表单数据
未经允许不得转载:工具盒子 » uniapp vue3获取表单数据