在iphone手机中,vue提供的keyup事件是不能监听iphone键盘的,但是h5提供的input事件可以做到。

只需要向下面这样处理,就可以解决iphone不响应键盘事件的bug

<template>
  <input type="text"  v-model="search" @keyup="get" @input="input" ref="input">
</template>
<script>
  export default {
    methods: {
      data() {
        return {
          search:''
        }
      },
      input() {
        var input = this.$refs.input;
        input.addEventListener('input',function(){
          this.search = input.value;
          console.log(this.search)
        },false)
      },
      get() {
        console.log(this.search)
      }
    }
  }
</script>

 

相关文章:

  • 2021-09-03
  • 2021-10-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-19
  • 2022-12-23
  • 2021-12-09
  • 2021-08-29
  • 2021-10-30
  • 2021-10-25
相关资源
相似解决方案