element-plus: When el-input set "value" attributes, it can't show this value in the input box. el-date-picker and el-radio-group maybe also have this problem.
version: vue@3.0.2 && element-plus@1.0.1-beta.3
example:
<template>
<el-card>
<el-input :value="12" @input="onInput"></el-input>
</el-card>
</template>
<script>
export default {
setup() {
// set reactive state for input
const onInput = value => {
console.log(value)
// modify reactive state...
}
// ignore reactive state no return
return { onInput }
}
}
</script>
In my own project, first, i write a reactive state for “:value” in ElInput, value doesn’t work.
Then, i write 12( :value=“12” ) or “12”( value=“12” ) for value directly. As shown in the code above.
They all can’t show value in the input box.
<el-date-picker> and <el-radio-group> also have this problem. However, their links passed in my project are more complicated, i may not know why. Only <el-input> has been tested by my minimal demo
I also discovered a magical phenomenon: it will display value after webpack hot update and display nothing after refresh
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (10 by maintainers)
Passing the value like you did above with the name
:modelValue=binding. You’ll get the same behavior likevalue