2024.12.9 小bug

2024.12.9 小bug

vue的script后面如果不加setup会导致vue组件绑定不上

image-20241209120842022

加上就好了

<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>

image-20241209120944291

posted @ 2024-12-09 12:10  vast_joy  阅读(4)  评论(0编辑  收藏  举报