How to hide or lose focus on the drop-down list of el-select through js or vue.js?

upgrading the latest version of elementUI makes it easier to use the blur method

Apr.11,2021

I tested it with JSFiddle .

Click button, and then click to expand the select, for two seconds when the setTimeout is over, the options will indeed be hidden.
still can't determine your problem for the time being.
maybe you can add some related code, or restore a demo with something like JSfiddle to check

.

I wonder if there is a blur event inside this component.? Ask the same question

clipboard.png

there is indeed this method in the source code! I wonder if your ref didn't get this component?


it's amazing that I also use this method. My focus () is invalid and, blur () is valid.

element-ui version 2.4.11

solution : el-select add filterable attribute, first can be output to focus


when you encounter the same problem, leave a solution for the newcomers:

put the final effect first: JSFiddle .

restore scenario:
1 when filterable is added, select will not automatically shrink
2 for multiple select add the same ref then this.$refs.chooseKpi.blur () invalidate / / chooseKpi is the rel name of select

experience:
1 there will be a pop-up window after switching option . Click cancel in the pop-up window or make sure that the shrinking effect of select will have different forms of expression

.
Menu