<!--
  @name: 表单
  @description: -
  @author 张文
  @date: 2022-01-25
-->
<template>
  <form @submit="submit">
    <slot></slot>
  </form>
</template>

<script>

export default {
  name: "tyForm",
  data() {
    return {}
  },
  methods: {
    submit(ev){
      const form = ev.target.getElementsByTagName('input')
      let data={}
      for (let i=0;i<form.length;i++){
        data[form[i].name] = form[i].value
      }
      ev.preventDefault();
      this.$emit('submit', data)
    }
  }
}
</script>

<style scoped lang="less">

</style>
