The Vue el-select drop-down box is not displayed when the selection is successful, but when other drop-down boxes are selected, it can be displayed successfully

I have only encountered this problem before. If you want to see it, you can take a look at this . I encountered it again today. Let’s take a look at the code part first.

There was no change event before, this was added after I solved it, this is not set through this.form.*, so it is not a problem of $set

and let me find,

The render function is not automatically updated, you need to use forceUpdate to force refresh the render

If the data in the drop-down box is obtained by looping through other interfaces, because there are too many layers of data, the render function is not automatically updated, and manual forced refresh is required, so I directly force refresh the value, and forceUpdate is to re-render. (For this situation, adding forceUpdate can solve it, and the principle should be the same.

Solution:

Add change event to select

 this.$forceUpdate() //添加下面代码即可解决你的问题

Guess you like

Origin blog.csdn.net/m0_48557659/article/details/129265594