diff --git a/doric-Qt/example/app/main.qml b/doric-Qt/example/app/main.qml index 7ef9ebdf..1797c900 100644 --- a/doric-Qt/example/app/main.qml +++ b/doric-Qt/example/app/main.qml @@ -169,7 +169,6 @@ ApplicationWindow { function navigatorPop() { stack.pop() - console.log("stack.depth", stack.depth) if (stack.depth > 1) { navbar.visible = true } else { diff --git a/doric-Qt/example/doric/plugin/DoricNavigatorPlugin.cpp b/doric-Qt/example/doric/plugin/DoricNavigatorPlugin.cpp index 47fd627a..015a14db 100644 --- a/doric-Qt/example/doric/plugin/DoricNavigatorPlugin.cpp +++ b/doric-Qt/example/doric/plugin/DoricNavigatorPlugin.cpp @@ -59,7 +59,21 @@ void DoricNavigatorPlugin::push(QString jsValueString, QString callbackId) { DoricThreadMode::JS); } -void DoricNavigatorPlugin::pop(QString jsValueString, QString callbackId) {} +void DoricNavigatorPlugin::pop(QString jsValueString, QString callbackId) { + getContext()->getDriver()->asyncCall( + [this] { + QObject *window = getContext()->getQmlEngine()->rootObjects().at(0); + QMetaObject::invokeMethod(window, "navigatorPop"); + }, + DoricThreadMode::UI); + + getContext()->getDriver()->asyncCall( + [this, callbackId] { + QVariantList args; + DoricPromise::resolve(getContext(), callbackId, args); + }, + DoricThreadMode::JS); +} void DoricNavigatorPlugin::popSelf(QString jsValueString, QString callbackId) {}