2024.12.9 小bug
2024.12.9 小bug
vue的script后面如果不加setup会导致vue组件绑定不上
加上就好了
<template>
<div style="height: 100px"></div>
<form action="/ai" method="post" id="aiForm">
aaaa
<input
v-model="aiMessageInput"
type="text"
name="aiMessageInput"
placeholder="请输入你要提问的问题"
required
/>
</form>
<div>
<button :onclick="onSubmit">提交</button>
</div>
</template>
<script setup lang="ts">
import { ref } from "vue";
import MyAxios from "@/plugins/myAxios";
const aiMessageInput = ref("");
const onSubmit = async () => {
const res = await MyAxios.post("/ai", {
aiMessage: aiMessageInput.value,
});
console.log(res);
};
</script>
<style scoped></style>