Van-UI发送验证码demo -效果篇

本文介绍了一款基于Van-UI框架的薪资选择组件实现,包括弹出层、薪资范围选择器及验证功能。该组件使用Vue.js进行开发,通过Van-Field和Van-Popup组件实现了薪资范围的输入和选择,同时提供了数据验证方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Van-UI发送验证码

样式:
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

       <van-field
          v-model="salaryRange"
          center
          disabled
          label="薪资"
          placeholder="请输入薪资"
        >
          <van-button slot="button" size="small" type="primary" @click="showSalaryRange = true">选择薪资<van-icon name="arrow-down" /></van-button>
        </van-field>
        <!-- 弹框:薪资范围 -->
        <van-popup v-model="showSalaryRange" position="bottom">
          <van-picker 
            show-toolbar 
            :columns="salaryRangecolumns" 
            @confirm="showSalaryRange = false" 
            @cancel="showSalaryRange = false" 
            @change="onClickPickSalaryRange" 
          />
        </van-popup>

<script>
export default {
  name: 'newForm',
  data(){
    return{
      errors: [],
      username: "",
      telphone: "",
      intention: "",  // 意向
      salaryRange: "",  // 薪资范围
      haracteristic: "",  // 特点
      checkedAgreement: true,
      showSalaryRange: false,  //薪资 弹出层不显示
      salaryRangecolumns: ['≤5K','5K-8K','8K-10K','≥10K']
    }
  },
  methods: {        
      onClickLeft() {
        this.$toast('返回');
        javascript:history.go(-1);
      },// 表单提交
      checkForm: function (e) {
        this.$toast("你点击了提交");
        this.errors = [];

        if (!this.username) {
          this.errors.push("username required.");
        }
        if (!this.password) {
          this.errors.push('password required.');
        } else if (!this.validEmail(this.password)) {
          this.errors.push('Valid password required.');
        }

        if (!this.errors.length) {
          return true;
        }

        e.preventDefault();
      },
      validEmail: function (password) {
        var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
        return re.test(password);
      },
      // 选择薪资
      onClickPickSalaryRange: function (picker, values) {
        console.log(values); // 返回结果
        this.salaryRange = values;
      }


  }
}

</script>




以上就是关于“ Van-UI发送验证码demo -效果篇 ” 的全部内容。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

草巾冒小子

你的赞赏正在生成下一个技术方案

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值