Vue 禁止输入框输入空格

2023-11-06

<template>
  <div>
    <input
      type="text"
      v-model="text"
      @input="(e) => text = e.target.value.replace(/\s/g,'')"
    >
  </div>
</template>

<script setup>
import { ref } from 'vue'
let text = ref(undefined)
</script>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Vue 禁止输入框输入空格 的相关文章

随机推荐