<template>
  <div class="account-login">
    <van-form class="login-form" ref="form" v-on="$listeners">
      <van-field v-model="ruleForm.account" name="account" label="账号" placeholder="请输入账号"></van-field>
      <van-field
        type="password"
        v-model="ruleForm.password"
        name="password"
        label="密码"
        placeholder="请输入密码"
      ></van-field>
    </van-form>
  </div>
</template>

<script>
export default {
  name: 'AccountLogin',
  data() {
    return {
      ruleForm: { type: 1, account: '', password: '' }
    }
  },
  methods: {
    submit() {
      if (!this.ruleForm.account) {
        this.$toast('请输入手机/邮箱/用户名')
        return false
      } else if (!this.ruleForm.password) {
        this.$toast('请输入密码')
        return false
      }
      return this.$refs.form.submit()
    }
  }
}
</script>
