这是预期的行为吗?
在“set to 'foo'”按钮上单击 2x 将导致 innerHTML 变为空。
import java.util.Random;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.router.Route;
@Route("test2")
public class V_Test2 extends Div
{
public V_Test2()
{
Div div = new Div();
add(div);
{
Button button = new Button("set to 'foo'");
button.addClickListener(e -> div.getElement().setProperty("innerHTML", "foo"));
add(button);
}
{
Button button = new Button("set random");
button.addClickListener(e -> div.getElement().setProperty("innerHTML", "bar-" + new Random().nextInt()));
add(button);
}
{
Button button = new Button("set to null");
button.addClickListener(e -> div.getElement().setProperty("innerHTML", null));
add(button);
}
}
}