请问Jmix是否有这种开关组件
可以集成 Vaadin 插件:https://vaadin.com/directory/component/togglebutton-for-flow/3.0.0
-
添加 Vaadin 插件仓库和依赖:
repositories { ... maven { url 'https://maven.vaadin.com/vaadin-addons' } } dependencies{ ... implementation 'com.vaadin.componentfactory:togglebutton:3.0.0' }
-
使用:
<div id="toggleDiv"/>
@ViewComponent private Div toggleDiv; @Autowired private Notifications notifications; @Subscribe public void onInit(final InitEvent event) { ToggleButton toggle = new ToggleButton(); toggle.setLabel("Label"); toggle.addValueChangeListener(evt -> notifications.create( String.format("Toggle button value changed from '%s' to '%s'", evt.getOldValue(), evt.getValue())).show()); toggleDiv.add(toggle); }
-
效果:
1 个赞
jmix1.5版本支持吗?