[Vuejs]-Pass Vue form submit event values to Axios without v-model

0👍

Considering you are specifying the form submit handler inside a vue sfc’s template tags, you’ll have to use the vue component to at least receive the event. Whether you handle the axios request in the method or just forward it along to some function in a js file is up to you.

If you want to use a vue method as little as possible, you could do something like this.

<template>
    <form @submite.prevent="handleFormSubmit">
        <input type="text" name="someforminput">
        <button type="submit">Submit</button>
    </form>
</template>

<script>
import { importedHandler } from './formHandlers.js';

export default {
    methods: {
        handleFormSubmit: e => importedHandler(e.target.someInput.value);
    },
}
</script>

Leave a comment