The el-input box in elementUi sometimes fails to input

When using element ui today, there is a text input box that cannot enter a value.
It can be added, and even the cursor cannot be moved when it is modified.
As shown in the figure, I
Insert picture description herethought that there was a problem with the code I wrote, which was caused by a binding error when I bound the value.
However, after investigation, there is no problem with the code:

  <el-row>
        <el-col :span="8">
          <el-form-item label="出版社名">
           
             <el-input v-model="dataForm.publisherName"   type="text" placeholder="出版社名称"></el-input>
          </el-form-item>
        </el-col>

So
the final result of the final solution is:

  <el-row>
        <el-col :span="8">
          <el-form-item label="出版社名">
           
             <el-input v-model="dataForm.publisherName" @input="change($event)" type="text" placeholder="出版社名称"></el-input>
          </el-form-item>
        </el-col>

 methods: {
    
    
    change(e){
    
    
      this.$forceUpdate();
    }}

Our solution is that we can capture event events during the change time of our input. There is a change status

Forced refresh of the changed state is applicable to situations where the view is not updated when the array or object changes. The updated function will be executed instead of refreshing the entire component. In this way, we can achieve our effect without changing the interface.
Insert picture description here
Problem solved

Guess you like

Origin blog.csdn.net/milijiangjun/article/details/108286119
Recommended