Create.vue 542 B

12345678910111213141516171819202122
  1. <script setup lang="ts">
  2. import AppLayout from "@/Layouts/AppLayout.vue";
  3. import ChatInput from "@/Components/ChatInput.vue";
  4. import {useForm} from "@inertiajs/vue3";
  5. const form = useForm({
  6. message: null
  7. })
  8. const submit = () => {
  9. form.post(route('chats.store'), {
  10. onSuccess: () => form.reset()
  11. })
  12. }
  13. </script>
  14. <template>
  15. <AppLayout page-class="mx-auto max-w-4xl flex items-center justify-center">
  16. <ChatInput v-model="form.message" :disabled="form.processing" @submit="submit"/>
  17. </AppLayout>
  18. </template>