How does vue dispatch a publication order to submit a submit event

<template>
  <el-container>
    <form action="/api/exportExcel">
      <input type="text" name="userid">
    </form>

    <!-- buttonform -->
    <button @click="onSubmit"></button>
  </el-container>
<template>
<script>
export default {
  methods: {
    exportExcel () {
      document.getElementById("expformsubmit").submit()
    }
  }
}
</script>

button is placed outside the form. How do I submit events after clicking on this button?
because the result is to action jump after form.submit () to generate the next excel file, ajax is not used.

the above code has been implemented, but if you use vue, you usually refuse to operate with DOM, right? So I want to know the solution based on vue.


this kind of dispatch event operation still uses the DOM operation, but VUE can do this.
add ref= "xxxx" to the form tag , and then use this.$refs.xxxx access in JS without tag search functions. For more information, please see

Previous: How to realize dynamic attribute assignment in yii2

Next: Why does the foreach loop affect the entire large array?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eaeb24-21fd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eaeb24-21fd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?