vue 拼写检查的实现

本文介绍了在Vue项目中如何实现拼写检查功能。主要内容包括在输入框中添加相关代码,通过click或blur事件控制触发模式,由于逻辑需求,选择在页面创建完成后初始化状态,并在提交时对所有输入项进行拼写检查。
摘要由CSDN通过智能技术生成

拼写检查部分

const rules = [
  {
   
    type: 'number',
    regexp: /^[0-9][0-9 | .]*[0-9]*$/,
    meg: i18n.t('validator.msg1') // 请输入数字

  },
  {
   
    type: 'positiveInt',
    regexp: /^\+?[1-9]\d*$/,
    meg: i18n.t('validator.msg2') // '请输入大于0的正整数!'
  },
  {
   
    type: 'positiveIntAnd0',
    regexp: /^[0-9]*$/,
    meg: i18n.t('validator.msg3') // '请输入正整数或0!'
  },
  {
   
    type: 'character',
    regexp: /^[A-Za-z]+$/,
    meg: i18n.t('validator.msg4') // '请输入字母!'
  },
  {
   
    type: 'charNum',
    regexp: /^[A-Za-z0-9]+$/,
    meg: i18n.t('validator.msg5') // '请输入英数字!'
  },
  {
   
    type: 'charNumUnderline',
    regexp: /^[0-9a-zA-Z_]{1,}$/,
    meg: i18n.t('validator.msg6') // '请输入英数字或下划线!'
  },
  {
   
    type: 'email',
    regexp: /^w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*$/,
    meg: i18n.t('validator.msg7') // '请输入正确的Email地址!'
  },
  {
   
    type: &
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值