【发布时间】:2017-11-03 20:34:02
【问题描述】:
我正在尝试添加占位符以选择反应中的元素。此时我正在使用:
<option disabled selected hidden>{props.placeholder || "Select options"}</option>
但我收到警告:
Warning: Use the `defaultValue` or `value` props on <select> instead of setting `selected` on <option>.
我已经尝试过 defaultValue 和其他几个,但没有任何效果。
干杯, 丹尼尔
【问题讨论】:
标签: html reactjs select placeholder