美文网首页
input框 中文模式 拼音问题

input框 中文模式 拼音问题

作者: 成神之路_be73 | 来源:发表于2021-07-28 14:28 被阅读0次

问题:
input需要监听变化,在使用中文模式进行输入时,页面上的拼音会引起变化,触发事件发送接口
解决方法:
将@change变为@input

<template>
  <input
    v-model="keyword"
    :placeholder="placeholder"
    @input="handleKeyup"
  />
</template>
<script>
export default {
  data() {
    return {
      placeholder: 'placeholder',
      keyword: '',
      time: null,
    };
  },
  methods: {
    handleKeyup: function () {
      clearTimeout(this.time);
      let keyword = this.keyword;
      keyword = keyword && String(keyword).trim();
      if (keyword) {
        this.time = setTimeout(() => {
          xxxxxxxx;
        }, 300);
      }
    },
  },
};
</script>

相关文章

  • input框 中文模式 拼音问题

    问题:input需要监听变化,在使用中文模式进行输入时,页面上的拼音会引起变化,触发事件发送接口解决方法:将@ch...

  • 控制input中只能输入数字---正则

    input输入框输入中文时,监听的input事件怎样屏蔽拼音状态 http://blog.sina.com.cn/...

  • 说说 Vue.js v-model 指令的修饰符

    1 .lazy v-model 指令默认会在 input 事件中加载输入框中的数据(中文输入法中输入拼音的过程除外...

  • input输入中文未完成时触发change事件

    最近做pc端时发现,在input输入中文时,拼音阶段就触发了change事件,造成了很多异常请求,如何修复此类问题...

  • 通过 webview 获取网页元素

    需求出现的原因是这样的: 出现了什么问题呢? 那么问题就出在 input 框这里,点击这个 input 框,调起 ...

  • 神奇的css

    在文本框中禁用中文输入法:input,textarea{ime-mode:disabled;} 移除被点链接的点框...

  • 自定义事件:textchange

    textchange应用场景 中文输入法在输入拼音时就会触发input事件 compositionstart和co...

  • form表单常用记录

    form表单常用记录 1、input框不能输入中文,只能字母、数字; onkeyup="value=value.r...

  • 记录bug

    react antd Input 输入框里的内容trim()之后,window上输入不了中文 getValueFr...

  • 2018-07-27

    1、移动端遇到的兼容问题? 1 input框输入问题 最开始在input输入框中,也会习惯性的写上linehei...

网友评论

      本文标题:input框 中文模式 拼音问题

      本文链接:https://www.haomeiwen.com/subject/hxyzmltx.html