<template>
  <view class="pa-3">
    <uni-forms ref="baseForm" :modelValue="baseFormData">
      <uni-forms-item label="姓名" required  label-width="100">
        <uni-easyinput v-model="baseFormData.name" placeholder="请输入姓名" />
      </uni-forms-item>
      <uni-forms-item label="手机号" required  label-width="100">
        <uni-easyinput v-model="baseFormData.phone" placeholder="请输入联系手机号" />
      </uni-forms-item>
      <uni-forms-item label="企业名称" required  label-width="100">
        <uni-easyinput v-model="baseFormData.enterpriseName" placeholder="请输入企业名称" />
      </uni-forms-item>
    </uni-forms>
    <button type="primary" @click="submit">提交</button>
  </view>
</template>

<script setup>
import { ref } from 'vue'
const baseForm = ref()
const baseFormData = ref({
  name: '',
  phone: '',
  enterpriseName: ''
})
const submit = async () => {
  await baseForm.value.validate()

  uni.showToast({ title: '保存成功', icon: 'none' })
  // baseForm.value.validate().then((res) => {
  //   console.log('表单数据：', res)
  //   uni.showToast({ title: '保存成功', icon: 'none' })
  // }).catch((err) => {
  //   // uni.showToast({ title: err?.msg || '保存失败', icon: 'none' })
  // })
}
</script>

<style lang="scss" scoped>
.pa-3 {
  padding: 30rpx;
}
</style>