element [Bug Report] el-select showing value instead of label after update options and binding value in watch method

unhi4e5o  于 2023-02-04  发布在  其他
关注(0)|答案(4)|浏览(334)

Element UI version

2.13.0

OS/Browsers version

macOS/Chrome80.0.3987.163

Vue version

2.6.11

https://codepen.io/v32vdqtgegf/pen/ZEbzawB

Steps to reproduce

  1. pick an option
  2. after 1sec delay it will show the updated value which label are expected

What is Expected?

show updated label

What is actually happening?

show value

ffscu2ro

ffscu2ro1#

try this
this.$nextTick(()=>{ this.value = "value6"; })

gt0wga4j

gt0wga4j2#

I have the same problem. It seems to only happen when the focus is on the Select Box.

p1iqtdky

p1iqtdky3#

you should not watch value, because will lead your code perform twice, you can console log like what i done,and you can find that it console two times which is not necessary.
instead watch change event, update the options in this function . do not put the options change code put in setTimeout,that will lead element not notice value change.
here is the code.
https://codepen.io/littledevil7/pen/jOWrzra?editors=1011

qni6mghb

qni6mghb4#

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

相关问题