impl navigator pop

This commit is contained in:
王劲鹏 2021-06-10 11:24:27 +08:00 committed by osborn
parent a48dd1de2f
commit 38f761aad7
2 changed files with 15 additions and 2 deletions

View File

@ -169,7 +169,6 @@ ApplicationWindow {
function navigatorPop() { function navigatorPop() {
stack.pop() stack.pop()
console.log("stack.depth", stack.depth)
if (stack.depth > 1) { if (stack.depth > 1) {
navbar.visible = true navbar.visible = true
} else { } else {

View File

@ -59,7 +59,21 @@ void DoricNavigatorPlugin::push(QString jsValueString, QString callbackId) {
DoricThreadMode::JS); 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) {} void DoricNavigatorPlugin::popSelf(QString jsValueString, QString callbackId) {}