Vue 禁止输入框输入空格 卡尔特斯 2023-09-05 56 阅读1分钟 <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>