add switch bridge

This commit is contained in:
王劲鹏
2021-05-27 18:18:30 +08:00
committed by osborn
parent b6033d6eb6
commit 19cc85cf1c
7 changed files with 52 additions and 1 deletions

View File

@@ -25,7 +25,7 @@ void DoricSwitchNode::blend(QQuickItem *view, QString name, QJsonValue prop) {
view->setProperty("checked", prop.toBool());
checkByCodeToggle = false;
} else if (name == "onSwitch") {
onSwitchFuncId = prop.toString();
} else if (name == "offTintColor") {
view->setProperty(
"offTintColor",
@@ -41,3 +41,13 @@ void DoricSwitchNode::blend(QQuickItem *view, QString name, QJsonValue prop) {
DoricViewNode::blend(view, name, prop);
}
}
void DoricSwitchNode::onSwitch(bool checked) {
if (checkByCodeToggle)
return;
if (!onSwitchFuncId.isEmpty()) {
QVariantList args;
args.append(checked);
callJSResponse(onSwitchFuncId, args);
}
}