From a48dd1de2f6e162ba41926e825681b0a8ce47e23 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:16:20 +0800 Subject: [PATCH] change navigator source acquire --- .../example/doric/plugin/DoricNavigatorPlugin.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/doric-Qt/example/doric/plugin/DoricNavigatorPlugin.cpp b/doric-Qt/example/doric/plugin/DoricNavigatorPlugin.cpp index e0eb6f7d..47fd627a 100644 --- a/doric-Qt/example/doric/plugin/DoricNavigatorPlugin.cpp +++ b/doric-Qt/example/doric/plugin/DoricNavigatorPlugin.cpp @@ -2,6 +2,7 @@ #include "DoricPanel.h" #include "engine/DoricPromise.h" +#include "loader/DoricJSLoaderManager.h" #include "utils/DoricUtils.h" #include @@ -26,9 +27,11 @@ void DoricNavigatorPlugin::push(QString jsValueString, QString callbackId) { } getContext()->getDriver()->asyncCall( - [this, alias] { - QString name = alias; - QString script = DoricUtils::readAssetFile("/doric/bundles", name); + [this, source, alias] { + std::shared_ptr asyncResult = + DoricJSLoaderManager::getInstance()->request(source); + + QString script = asyncResult->getResult(); QQmlComponent component(getContext()->getQmlEngine()); const QUrl url(QStringLiteral("qrc:/doric/qml/panel.qml")); @@ -39,7 +42,7 @@ void DoricNavigatorPlugin::push(QString jsValueString, QString callbackId) { new DoricPanel(getContext()->getQmlEngine(), quickItem); quickItem->setWidth(600); quickItem->setHeight(800); - panel->config(script, name, NULL); + panel->config(script, alias, NULL); QObject *window = getContext()->getQmlEngine()->rootObjects().at(0); QVariant arg = QVariant::fromValue(object);