From ab0ab98aaa0273a8a4fef07d93b1e34b845bcfa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Thu, 10 Jun 2021 11:27:33 +0800 Subject: [PATCH] impl pop self --- .../doric/plugin/DoricNavigatorPlugin.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/doric-Qt/example/doric/plugin/DoricNavigatorPlugin.cpp b/doric-Qt/example/doric/plugin/DoricNavigatorPlugin.cpp index 015a14db..65c2a182 100644 --- a/doric-Qt/example/doric/plugin/DoricNavigatorPlugin.cpp +++ b/doric-Qt/example/doric/plugin/DoricNavigatorPlugin.cpp @@ -75,7 +75,21 @@ void DoricNavigatorPlugin::pop(QString jsValueString, QString callbackId) { DoricThreadMode::JS); } -void DoricNavigatorPlugin::popSelf(QString jsValueString, QString callbackId) {} +void DoricNavigatorPlugin::popSelf(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::popToRoot(QString jsValueString, QString callbackId) {}