vux的x-input的源码分析

<template>
    <div class="vux-x-input weui-cell" :class="{'weui-cell_warn': showWarn}">
    <div class="weui-cell__hd">
      <div :style="labelStyles" v-if="hasRestrictedLabel">
        <slot name="restricted-label"></slot>
      </div>
      <slot name="label">
        <label class="weui-label" :class="labelClass" :style="{width: labelWidth || $parent.labelWidth || labelWidthComputed, textAlign: $parent.labelAlign, marginRight: $parent.labelMarginRight}" v-if="title" v-html="title"></label>
        <inline-desc v-if="inlineDesc">{{inlineDesc}}</inline-desc>
      </slot>
    </div>
    <div class="weui-cell__bd weui-cell__primary" :class="placeholderAlign ? `vux-x-input-placeholder-${placeholderAlign}` : ''">
      <input
      v-if="!type || type === 'text'"
      class="weui-input"
      :maxlength="max"
      :autocomplete="autocomplete"
      :autocapitalize="autocapitalize"
      :autocorrect="autocorrect"
      :spellcheck="spellcheck"
      :style="inputStyle"
      type="text"
      :name="name"
      :pattern="pattern"
      :placeholder="placeholder"
      :readonly="readonly"
      :disabled="disabled"
      v-model="currentValue"
      @focus="focusHandler"
      @blur="onBlur"
      @keyup="onKeyUp"
      ref="input"/>
      <input
      v-if="type === 'number'"
      class="weui-input"
      :maxlength="max"
      :autocomplete="autocomplete"
      :autocapitalize="autocapitalize"
      :autocorrect="autocorrect"
      :spellcheck="spellcheck"
      :style="inputStyle"
      type="number"
      :name="name"
      :pattern="pattern"
      :placeholder="placeholder"
      :readonly="readonly"
      :disabled="disabled"
      v-model="currentValue"
      @focus="focusHandler"
      @blur="onBlur"
      @keyup="onKeyUp"
      ref="input"/>
      <input
      v-if="type === 'email'"
      class="weui-input"
      :maxlength="max"
      :autocomplete="autocomplete"
      :autocapitalize="autocapitalize"
      :autocorrect="autocorrect"
      :spellcheck="spellcheck"
      :style="inputStyle"
      type="email"
      :name="name"
      :pattern="pattern"
      :placeholder="placeholder"
      :readonly="readonly"
      :disabled="disabled"
      v-model="currentValue"
      @focus="focusHandler"
      @blur="onBlur"
      @keyup="onKeyUp"
      ref="input"/>
      <input
      v-if="type === 'password'"
      class="weui-input"
      :maxlength="max"
      :autocomplete="autocomplete"
      :autocapitalize="autocapitalize"
      :autocorrect="autocorrect"
      :spellcheck="spellcheck"
      :style="inputStyle"
      type="password"
      :name="name"
      :pattern="pattern"
      :placeholder="placeholder"
      :readonly="readonly"
      :disabled="disabled"
      v-model="currentValue"
      @focus="focusHandler"
      @blur="onBlur"
      @keyup="onKeyUp"
      ref="input"/>
      <input
      v-if="type === 'tel'"
      class="weui-input"
      :maxlength="max"
      :autocomplete="autocomplete"
      :autocapitalize="autocapitalize"
      :autocorrect="autocorrect"
      :spellcheck="spellcheck"
      :style="inputStyle"
      type="tel"
      :name="name"
      :pattern="pattern"
      :placeholder="placeholder"
      :readonly="readonly"
      :disabled="disabled"
      v-model="currentValue"
      @focus="focusHandler"
      @blur="onBlur"
      @keyup="onKeyUp"
      ref="input"/>
    </div>
    <div class="weui-cell__ft">
      <icon type="clear" v-show="!equalWith && showClear && currentValue && !readonly && !disabled" @click.native="clear"></icon>

      <icon class="vux-input-icon" type="warn" :title="!valid ? firstError : ''" v-show="showWarn"></icon>
      <icon class="vux-input-icon" type="warn" v-if="!novalidate && hasLengthEqual && dirty && equalWith && !valid"></icon>
      <icon type="success" v-show="!novalidate && equalWith && equalWith === currentValue && valid"></icon>

      <icon type="success" class="vux-input-icon" v-show="novalidate && iconType === 'success'"></icon>
      <icon type="warn" class="vux-input-icon" v-show="novalidate && iconType === 'error'"></icon>

      <slot name="right"></slot>
    </div>
  </div>
</template>

<script>
import Base from '../../libs/base'
import Icon from '../icon'
import InlineDesc from '../inline-desc'

import isEmail from 'validator/lib/isEmail'
import isMobilePhone from 'validator/lib/isMobilePhone'

import Debounce from '../../tools/debounce'

const validators = {
  'email': {
    fn: isEmail,
    msg: '邮箱格式'
  },
  'china-mobile': {
    fn (str) {
      return isMobilePhone(str, 'zh-CN')
    },
    msg: '手机号码'
  },
  'china-name': {
    fn (str) {
      return str.length >= 2 && str.length <= 6
    },
    msg: '中文姓名'
  }
}
export default {
  name: 'x-input',
  created () {
    this.currentValue = (this.value === undefined || this.value === null) ? '' : this.value
    if (!this.title && !this.placeholder && !this.currentValue) {
      console.warn('no title and no placeholder?')
    }
    if (this.required && !this.currentValue) {
      this.valid = false
    }
    this.handleChangeEvent = true
    if (this.debounce) {
      this._debounce = Debounce(() => {
        this.$emit('on-change', this.currentValue)
      }, this.debounce)
    }
  },
  mounted () {
    if (this.$slots && this.$slots['restricted-label']) {
      this.hasRestrictedLabel = true
    }
  },
  beforeDestroy () {
    if (this._debounce) {
      this._debounce.cancel()
    }
  },
  mixins: [Base],
  components: {
    Icon,
    InlineDesc
  },
  props: {
    title: {
      type: String,
      default: ''
    },
    type: {
      type: String,
      default: 'text'
    },
    placeholder: String,
    value: [String, Number],
    name: String,
    readonly: Boolean,
    disabled: Boolean,
    keyboard: String,
    inlineDesc: String,
    isType: [String, Function],
    min: Number,
    max: Number,
    showClear: {
      type: Boolean,
      default: true
    },
    equalWith: String,
    textAlign: String,
    // https://github.com/yisibl/blog/issues/3
    autocomplete: {
      type: String,
      default: 'off'
    },
    autocapitalize: {
      type: String,
      default: 'off'
    },
    autocorrect: {
      type: String,
      default: 'off'
    },
    spellcheck: {
      type: String,
      default: 'false'
    },
    novalidate: {
      type: Boolean,
      default: false
    },
    iconType: String,
    debounce: Number,
    placeholderAlign: String,
    labelWidth: String
  },
  computed: {
    labelStyles () {
      return {
        width: this.labelWidthComputed || this.$parent.labelWidth || this.labelWidthComputed,
        textAlign: this.$parent.labelAlign,
        marginRight: this.$parent.labelMarginRight
      }
    },
    labelClass () {
      return {
        'vux-cell-justify': this.$parent.labelAlign === 'justify' || this.$parent.$parent.labelAlign === 'justify'
      }
    },
    pattern () {
      if (this.keyboard === 'number' || this.isType === 'china-mobile') {
        return '[0-9]*'
      }
    },
    labelWidthComputed () {
      const width = this.title.replace(/[^x00-xff]/g, '00').length / 2 + 1
      if (width < 10) {
        return width + 'em'
      }
    },
    hasErrors () {
      return Object.keys(this.errors).length > 0
    },
    inputStyle () {
      if (this.textAlign) {
        return {
          textAlign: this.textAlign
        }
      }
    },
    showWarn () {
      return !this.novalidate && !this.equalWith && !this.valid && this.firstError && (this.touched || this.forceShowError)
    }
  },
  methods: {
    reset (value = '') {
      this.dirty = false
      this.currentValue = value
      this.firstError = ''
      this.valid = true
    },
    clear () {
      this.currentValue = ''
      this.focus()
    },
    focus () {
      this.$refs.input.focus()
    },
    blur () {
      this.$refs.input.blur()
    },
    focusHandler ($event) {
      this.$emit('on-focus', this.currentValue, $event)
    },
    onBlur ($event) {
      this.setTouched()
      this.validate()
      this.$emit('on-blur', this.currentValue, $event)
    },
    onKeyUp (e) {
      if (e.key === 'Enter') {
        e.target.blur()
        this.$emit('on-enter', this.currentValue, e)
      }
    },
    getError () {
      let key = Object.keys(this.errors)[0]
      this.firstError = this.errors[key]
    },
    validate () {
      if (typeof this.equalWith !== 'undefined') {
        this.validateEqual()
        return
      }
      this.errors = {}

      if (!this.currentValue && !this.required) {
        this.valid = true
        return
      }

      if (!this.currentValue && this.required) {
        this.valid = false
        this.errors.required = '必填哦'
        this.getError()
        return
      }

      if (typeof this.isType === 'string') {
        const validator = validators[this.isType]
        if (validator) {
          this.valid = validator[ 'fn' ](this.currentValue)
          if (!this.valid) {
            this.forceShowError = true
            this.errors.format = validator[ 'msg' ] + '格式不对哦~'
            this.getError()
            return
          } else {
            delete this.errors.format
          }
        }
      }

      if (typeof this.isType === 'function') {
        const validStatus = this.isType(this.currentValue)
        this.valid = validStatus.valid
        if (!this.valid) {
          this.errors.format = validStatus.msg
          this.forceShowError = true
          if (!this.firstError) {
            this.getError()
          }
          return
        } else {
          delete this.errors.format
        }
      }

      if (this.min) {
        if (this.currentValue.length < this.min) {
          this.errors.min = `最少应该输入${this.min}个字符哦`
          this.valid = false
          if (!this.firstError) {
            this.getError()
          }
          return
        } else {
          delete this.errors.min
        }
      }

      if (this.max) {
        if (this.currentValue.length > this.max) {
          this.errors.max = `最多可以输入${this.max}个字符哦`
          this.valid = false
          this.forceShowError = true
          return
        } else {
          this.forceShowError = false
          delete this.errors.max
        }
      }

      this.valid = true
    },
    validateEqual () {
      if (!this.equalWith && this.currentValue) {
        this.valid = false
        this.errors.equal = '输入不一致'
        return
      }
      let willCheck = this.dirty || this.currentValue.length >= this.equalWith.length
      // 只在长度符合时显示正确与否
      if (willCheck && this.currentValue !== this.equalWith) {
        this.valid = false
        this.errors.equal = '输入不一致'
        return
      } else {
        if (!this.currentValue && this.required) {
          this.valid = false
        } else {
          this.valid = true
          delete this.errors.equal
        }
      }
    }
  },
  data () {
    let data = {
      hasRestrictedLabel: false,
      firstError: '',
      forceShowError: false,
      hasLengthEqual: false,
      valid: true,
      currentValue: ''
    }
    return data
  },
  watch: {
    valid () {
      this.getError()
    },
    value (val) {
      this.currentValue = val
    },
    equalWith (newVal) {
      if (newVal && this.equalWith) {
        if (newVal.length === this.equalWith.length) {
          this.hasLengthEqual = true
        }
        this.validateEqual()
      } else {
        this.validate()
      }
    },
    currentValue (newVal) {
      if (!this.equalWith && newVal) {
        this.validateEqual()
      }
      if (newVal && this.equalWith) {
        if (newVal.length === this.equalWith.length) {
          this.hasLengthEqual = true
        }
        this.validateEqual()
      } else {
        this.validate()
      }
      this.$emit('input', newVal)
      if (this._debounce) {
        this._debounce()
      } else {
        this.$emit('on-change', newVal)
      }
    }
  }
}
</script>

<style lang="less">
@import '../../styles/weui/widget/weui_cell/weui_access';
@import '../../styles/weui/widget/weui_cell/weui_cell_global';
@import '../../styles/weui/widget/weui_cell/weui_form/weui_form_common';
@import '../../styles/weui/widget/weui_cell/weui_form/weui_vcode';
.vux-x-input .vux-x-input-placeholder-right input::-webkit-input-placeholder {
  text-align: right;
}
.vux-x-input .vux-x-input-placeholder-center input::-webkit-input-placeholder {
  text-align: center;
}
.vux-x-input .vux-input-icon {
  font-size: 21px;
}
.vux-input-icon.weui-icon-warn:before, .vux-input-icon.weui-icon-success:before {
  font-size: 21px;
}
.vux-x-input .weui-icon {
  padding-left: 5px;
}
.vux-x-input.weui-cell_vcode {
  padding-top: 0;
  padding-right: 0;
  padding-bottom: 0;
}
</style>

1.学习到的props中继承的属性时,引用的时候没有必要在属性前添加:。

2.:class 和class可以并存。

3. 双引号中套单引号。

4.右边嵌入一个框的时候,:class中嵌入一个,在icon中嵌入一个。

5.

转载于:https://www.cnblogs.com/coding4/p/7509282.html

浅谈vux之x-input使用以及源码解读 主要介绍了浅谈vux之x-input使用以及源码解读,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧 立即下载

相关推荐

【异常】解决JDK21升级中的SecurityException: JCE无法验证BC提供者问题

本文详细解析了JDK21升级中常见的SecurityException: JCE无法验证BC提供者问题的根源与解决方案。核心在于JDK21强化了JCE安全验证,导致签名不合规的老版本Bouncy Castle库被拒绝。文章提供了通过Maven依赖树精准定位、排除旧版本并引入兼容的bcprov-jdk18on新库的完整步骤,以及清理缓存等实战技巧,帮助开发者彻底解决此兼容性问题。

weixin_29197051的博客 487

vue input输入框联想输入

input 联想输入框 <el-form label="新管理员:" ref="transferDataForm"> <!-- key="temp.useridList" @change="changeUserid" --> <el-select v-model="transferDialogForm.entity.createBy" ...

MrLiar的博客 3506

Aras Innovator系统配置-01对象类(一)

对象类配置-对象类属性说明

企业信息化(PLM,ERP.MES) 2031

vex-table 年选择器格式化返回值

<vxe-input v-model="formData.year" placeholder="请选择货品年份" type="year" clearable value-format="yyyy" style="width:100%"></vxe-input>

zmlucky的博客 742

告别交越失真:手把手教你设计高性能互补输出级电路(LTspice实测)

本文深入剖析音频放大器中常见的交越失真问题,并提供基于LTspice仿真的实战解决方案。通过对比二极管偏置、Vbe倍增器和集成运放驱动三种经典方案,手把手指导设计高性能互补输出级电路,涵盖原理分析、仿真验证及实物调试要点,助力消除音频失真,提升音质。

weixin_29190573的博客 551

Excel地理探测器实战:5分钟搞定空间分异性分析(附完整数据集)

本文详细介绍了如何使用Excel地理探测器插件进行空间分异性分析。通过5分钟实战教程,手把手指导数据格式准备、软件操作及四大探测器(分异及因子、交互作用、风险区、生态探测器)的结果解读,帮助规划师、研究者快速验证地理因素对现象分布的影响,大幅降低GIS分析门槛。

peace的博客 607

Vue+Vux 移动端自适应开发模板(附源码)

Vue-Moblie-Templet-For-Vux 这是一个Vue结合Vux开发移动的端的模板,并且用了vw的自适应解决方案,模板已经解决了转换css大小单位为vm时, 把Vux中的css单位也处理,导致vux组件变形的bug。 如果你是用Vux开发移动端,并且加入vw自适应解决方案,可以直接clone项目直接开始开发 项目地址 Github: https://g...

Gavin的博客 1万+

ERDAS 2022与ArcGIS共存安装教程:如何避免端口冲突(详细配置步骤)

本文提供了一份详细的ERDAS 2022与ArcGIS共存安装教程,核心在于解决两者因FlexNet许可证服务器导致的端口冲突问题。通过分步指导,包括检查现有端口占用、修改ERDAS许可证文件端口号、配置防火墙及客户端设置,确保两款专业GIS与遥感软件能在同一系统上稳定运行。

weixin_29279047的博客 253

vux 显示 html,浅谈vux之x-input使用以及源码解读

前言近期项目中使用的vux中的input,以及使用自定义校验规则和动态匹配错误提示,有时间记录下自己的使用经历和源码分析。希望大家多多指正,留言区发表自己宝贵的建议。 详解 列举官方文档中常用的几个属性的使用方法,代码如下class="vux-input__name"title="名字"placeholder="tell me your name"required:is-type="checkNa...

weixin_39977934的博客 574

elevation mapping算法3之使用D435i相机离线或在线订阅点云和tf关系生成高程图

本文主要学习使用D435i相机发出的点云作为高程图的点云输入,如何离线输入点云生成高程图,进一步学习如何在线订阅点云生成高程图。

重点记录机器人和自动驾驶相关领域的技术,尤其是计算机视觉,视觉SLAM等,不仅有前言文献或必备算法的学习,也会有实际应用的点滴经验 3488

Java Swing教程-16. Swing中的图形绘制

这篇教程介绍了Java Swing中的图形绘制功能,主要内容包括: Graphics类的基本使用 - 介绍了如何重写paintComponent方法实现自定义绘制,以及基本图形绘制方法(线条、矩形、椭圆、多边形等) 文本与图片绘制 - 讲解了文本绘制方法、字体设置和图片加载绘制技术 颜色与字体设置 - 包括预定义颜色、RGB自定义颜色、透明色设置以及字体样式控制 案例实现 - 提供了一个简单绘图程序的框架,支持鼠标绘制不同图形、选择工具和自定义颜色等功能 教程通过代码示例详细演示了各种绘图操作,适合Java

无 232

vux框架安卓input无法情况

由于历史原因,当时vue2.x比较火,公司在公众号有个项目,后来选了vux框架,后续作者不更新了其实觉得挺可惜,毕竟个人项目也能理解,如果作者看到的话也希望可以继续更新,现在vue3.0了,不知道原vux框架作者是否会跟进,我自己也已经在使用vue3.0搭建了一个新项目,有问题可以留言讨论。毕竟大家都是从新手过来的哈哈哈。

u014708123的博客 127

从入门到精通:LabVIEW全攻略

本文为 LabVIEW 全攻略指南,系统梳理从基础到高级的核心知识与应用技巧。首先介绍 LabVIEW 的图形化编程特性、数据流运行机制及开发环境,通过创建与调试 VI 的实操演示帮助入门。接着深入解析程序结构(循环、分支、顺序)、数据类型(数组、簇、波形)及图形显示技术(Graph、XY Graph 等)的原理与应用场景。高级部分涵盖多线程编程、错误处理、硬件通信及第三方工具集成等进阶技术,并针对程序逻辑、硬件适配、性能优化等常见问题提供排查与解决方案。

邓邓子的博客 3568

vux之x-input使用以及源码解读

前言 近期项目中使用的vux中的input,以及使用自定义校验规则和动态匹配错误提示,有时间记录下自己的使用经历和源码分析。希望大家多多指正,留言区发表自己宝贵的建议。 详解 列举官方文档中常用的几个属性的使用方法,代码如下 &lt;group ref="group"&gt; &lt;x-input v-model="name" class="vux-inpu...

weixin_34082177的博客 1986

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

使用 xinput 配置输入设备

它可以列出所有输入设备,查询设备属性,设置设备属性,以及将设备映射到特定的输出。• 无效参数错误:确保设备ID和输出名称正确,并且设备支持映射到指定的输出。• 映射设备到输出:将输入设备映射到特定的显示输出,常用于多显示器设置。• 设备ID冲突:如果有多个设备名称相同,可以使用设备ID来避免冲突。使用设备ID查询设备的详细信息和属性。• 设置设备属性:修改设备的属性,如灵敏度、加速度等。• 列出输入设备:显示当前连接的所有输入设备。• 查询设备属性:获取设备的详细信息和属性。

qq_64057061的博客 2696

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

vux组件 x-input禁止输入特殊字符

最近在做的项目要通过一个安全测评,其中有一个安全要求是前段禁止输入特殊字符,记录一下实现的方式。 首先在main.js中天添加下面这个全局方法,来过滤特殊字符。 Vue.prototype.validForbid = function (value) { if (value) { value = value.replace(/[`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘

weixin_41554281的博客 963

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

VuxUI使用历程:【003】Vux组件使用之FormPreview组件、X-input组件、Loading 组件

Vux:FormPreview组件 import { FormPreview } from 'vux' export default { components: { FormPreview } } FormPreview组件使用场景Demo 使用方法同上一个一致 https://blog.youkuaiyun.com/qq_15980721/article/details/1023...

竹映平昔 673

手柄xinput模式_让你的普通手柄变成360手柄(XInputEmulator)

Xinput pad 模拟程序DLL是一个代理DLL, 目的是为了将兼容DirectInput的游戏手柄能够被支持XBox360手柄的游戏所识别。并且能够使普通手柄在原本只支持xbox360手柄震动的游戏中也能震动。本配置程序是为了配置手柄的键位映射关系,使得你的手柄能够尽量跟XBox360手柄的键位相同。【XInputEmulator使用方法】解压后放到游戏的安装目录下有游戏启动程序的文件夹内 ...

weixin_31704137的博客 2万+

通过 xinput 禁用/启用输入设备

Table of Contents 前言 方法 通过 xinput list 查看当前的输入设备 通过 xinput --list-props 查看设备的状态 通过 xinput --set-prop 修改设备的状态 整体脚本 前言 Xorg 运行过程中,可以通过 xinput 对输入设备进行管理。这在一些情况下是很有用的,譬如手掌比较大的人,使用笔记本电脑时,可能会误触到触摸板(touchpad)。突然移动的光标让人无法专业工作,同时,还可能导致在不恰当的地方插入了字符。这是令人很烦的事情。

机房看门人的博客 3960

<input> 标签的 readonly 属性

实例 带有两个文本字段和一个提交按钮的 HTML 表单: <form action="form_action.asp" method="get"> Name:<input type="text" name="email" /> Country:<input type="text" name="country" value="China" readonly="readonly" /> <input type="submit" value="Submit"

Jerry Man的博客 3284

DirectInput转XInput:让经典游戏手柄在现代PC平台重获新生

你是否曾经翻出尘封的游戏手柄,却发现它在最新的PC游戏中完全无法识别?这并非硬件故障,而是技术标准迭代带来的兼容性鸿沟。DirectInput与XInput两大输入协议之间的差异,让无数经典手柄在现代游戏世界中黯然失色。但别担心,开源社区已经提供了完美的解决方案——XOutput,一个精巧的DirectInput到XInput转换工具,让老设备在现代系统中焕发第二春。 ## 技术鸿沟解析:为什么

gitblog_00076的博客 279

vuex 2.0 源码解读

准备工作 1.下载安装运行 这里以2.0.0-rc.6为例官网github下载链接(对应版本):https://github.com/vuejs/vuex...点击下载到本地 按照readme.md $ npm install $ npm run dev # serve examples at localhost:8080 2.exam...

weixin_33893473的博客 242

jquery取<input>的readOnly属性,O要大写

今天在jquery中取input的readonly属性时,发现 我这样写$(“#input”).readonly取这个属性时,总是undefined,后来一想,难道html中的属性only没有大写,是不是javascript需要将O大写, 修改之后$(“#input”).readOnly,就能取到值,下面是后来我又搜到的一篇文章。 Javascript: 为设置readOnly属性 h

云枫的专栏 1万+

input 框中debounce_Vue.js页面中有多个input搜索框如何实现防抖操作

debounce简介debounce是lodash工具库中的一个非常好用的函数。在实现搜索框对输入进行动态查询的时候,我们需要防止前端频繁的发送查询请求给后端,这个时候就需要用到debounce,它可以设置一个时间间隔,比如300ms,忽略300毫秒内的输入变化。debounce的详细介绍可以参考 这篇 文章。debounce的高级用法博主的页面中有3个搜索框,每个搜索框都需要动态响应用户的输入到...

weixin_39800957的博客 423

一个购买数字输入组件的示例(基于vux-input)

由于H5页面大多做的是理财产品的一些流程,对于购买数字的输入框,需要有各种限制,逐渐形成一个组件,调用方法示例 <money-input title="XX金额" :placeholder="defaultPlaceholder" :verifyErrMsg="errMsg" @change="updateMoney" ...

front end workhorse zuo 530

vue监听input输入事件-oninput

.vue文件其实是一个组件,关于它的说明我之前也写过一篇文章,地址: .vue文件,今天这篇文章要讲的是.vue文件中监听input的输入值变化事件。需求是这页面中,改变input的值,就调用一个事件,第一想到的是oninput。 oninput 事件在用户输入时触发,菜鸟教程中的用法是: 但是在.vue中这样写是没有作用的: &lt;input type="text" id="...

一只爱吃糖的小羊 10万+
上一篇: nodejs实现文件的拷贝复制
下一篇: js中use或者using方法
de1981
博客等级 码龄12年 8粉丝 208原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值