首页 > 解决方案 > 如何在 code.org 中显示数据集中的文本?

问题描述

我正在开发一款龙与地下城应用程序,该应用程序最终将显示来自 D&D 书籍的信息。所以我试图从数据集中显示拼写信息。我尝试使用 readRecords 和 updateScreen 并在屏幕上显示“未定义”

我非常感谢任何有用的提示。 https://studio.code.org/projects/applab/VKNZ6xoJsy1ahETdh4R23_-Fs-JI3aF714hsoJqi3qg

标签: code.orgapp-lab

解决方案


您需要updateScreen(spellOptions, spellTime);从第 87 行移动到第readRecords()84 行的块中。您还需要设置spellTimerecords[0].time.

下面是第 84 到 87 行的代码:

readRecords("Spells", {name: spellOptions}, function(records) {
  spellTime = records[0].spellTime;
  updateScreen(spellOptions, spellTime);
});

推荐阅读