complete pure call

This commit is contained in:
王劲鹏
2021-05-31 16:00:06 +08:00
committed by osborn
parent 9f721aa1c8
commit 4c5cd39320
12 changed files with 66 additions and 68 deletions

View File

@@ -232,8 +232,8 @@ DoricViewNode::pureCallJSResponse(QString funcId, QVariantList args) {
foreach (const QVariant &arg, args)
nArgs.append(arg);
return getContext()->callEntity(DoricConstant::DORIC_CONTEXT_INVOKE_PURE,
nArgs);
return getContext()->getDriver()->invokeDoricMethod(
DoricConstant::DORIC_CONTEXT_INVOKE_PURE, nArgs);
}
void DoricViewNode::onClick() {

View File

@@ -32,15 +32,33 @@ void DoricSliderNode::blendSubNode(QJsonValue subProperties) {
}
}
void DoricSliderNode::blend(QJsonValue jsValue) {}
void DoricSliderNode::blend(QQuickItem *view, QString name, QJsonValue prop) {}
void DoricSliderNode::blend(QQuickItem *view, QString name, QJsonValue prop) {
if (name == "itemCount") {
this->itemCount = prop.toInt();
} else if (name == "renderPage") {
if (prop.toString() != this->renderPageFuncId) {
this->childNodes.clear();
this->renderPageFuncId = prop.toString();
}
} else if (name == "batchCount") {
this->batchCount = prop.toInt();
} else if (name == "onPageSlided") {
this->onPageSelectedFuncId = prop.toString();
} else if (name == "loop") {
this->loop = prop.toBool();
} else {
DoricViewNode::blend(view, name, prop);
}
}
void DoricSliderNode::afterBlended(QJsonValue prop) {
if (this->childNodes.length() != this->itemCount) {
QVariantList args;
args.append(this->childNodes.length());
args.append(this->itemCount);
this->pureCallJSResponse("renderBunchedItems", args);
std::shared_ptr<DoricAsyncResult> asyncResult =
this->pureCallJSResponse("renderBunchedItems", args);
QString result = asyncResult->waitUntilResult();
qDebug() << result;
}
}

View File

@@ -25,8 +25,6 @@ public:
virtual void blendSubNode(QJsonValue subProperties) override;
virtual void blend(QJsonValue jsValue) override;
virtual void blend(QQuickItem *view, QString name, QJsonValue prop) override;
virtual void afterBlended(QJsonValue prop) override;