gpt4 book ai didi

javascript - 检查模板是否已完全加载 - Aria 模板

转载 作者:行者123 更新时间:2023-11-30 10:29:59 25 4
gpt4 key购买 nike

我正在使用以下代码在 Aria 中加载模板:

  Aria.loadTemplate({
classpath : test,
div : "thecontainer",


});

谁能告诉我如何将回调附加到此函数。这应该告诉我模板加载是否完成或没有。

最佳答案

您只向函数传递了一个参数,一个 cfg 对象。您可以将回调作为第二个参数传递给 Aria.loadTemplate

查看源码: https://github.com/ariatemplates/ariatemplates/blob/v1.4.6/src/aria/Aria.js#L1379

@param {aria.core.JsObject.Callback} callback which will be called when the template is loaded or if there is an error.

The first parameter of the callback is a JSON object with the following properties:

{ success : {Boolean} true if the template was displayed, false otherwise }

Note that the callback is called when the template is loaded, but sub-templates may still be waiting to be loaded (showing a loading indicator). Note that success==true means that the template was displayed, but there may be errors inside some widgets or sub-templates.

关于javascript - 检查模板是否已完全加载 - Aria 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17401979/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com