input element v-model change event not trigger in ios #8561
Unanswered
mannymu
asked this question in
Help/Questions
Replies: 1 comment
-
I think this is the behavior of Safari. Not related to Vue itself. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Vue version
3.2.13
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-wedyrh?file=src%2FApp.vue&terminal=dev
Steps to reproduce
When I enter a number, the change and blur events are triggered on the Android phone. But the ios phone only triggers the blur event, and the change does not trigger。
`
<input type="text" v-model="inputValue" @input="onInput" @change="onChange" @blur="onBlur" >
<script> import { reactive,toRefs } from 'vue' export default { setup(){ const state = reactive({ inputValue:'', }); const onChange = ()=>{ // ios 14.0 iphone 7 plus not trigger // android is ok console.log("onChange",state.inputValue); } const onInput = ($event)=>{ let val = $event.target.value.trim(); val = val.replaceAll(",",''); state.inputValue = val.split("").join(","); } const onBlur = ()=>{ // all trigger console.log("onBlur",state.inputValue); } return { ...toRefs(state), onChange, onInput, onBlur } } } </script>
`
What is expected?
ios can trigger change event 。 Android phone is trigger。
What is actually happening?
change event is not triggered
System Info
Any additional comments?
No response
Beta Was this translation helpful? Give feedback.
All reactions