Titanium Appcelerator 中基于 URL 的窗口

发布于 2024-11-17 13:08:52 字数 135 浏览 5 评论 0原文

我有一些问题

  • 如何在钛合金中使用基于 url 的窗口?
  • 将 url 设置为“.js”文件是否会运行文件中的所有代码,还是仅打开窗口?
  • 它如何知道确切的窗口?是否需要任何命名约定?

I have some questions

  • How do you use url based windows in titanium?
  • Does setting the url to a ".js" file run all the code in the file or does it just open the window?
  • How does it come to know about the exact Window? Is there any naming convention required?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

歌入人心 2024-11-24 13:08:52

没有命名约定,您只需使用路径。 window.url = windows/window1.js 另外,正如您猜对的那样,当窗口打开时,代码也会运行:-)

var window = Ti.UI.createWindow({
    url: 'windows/window1.js'
});

来自 docs: "带有 Windows 指令的 JavaScript 文件的 URL,此窗口将创建一个新的 JavaScript 子上下文,该子上下文将在其中运行。自己的线程和全局变量 空间。”

我认为这个子上下文信息将帮助您最了解他们。

No naming conventions and you just use the path. window.url = windows/window1.js Also the code run when the window is open as you correctly guessed :-)

var window = Ti.UI.createWindow({
    url: 'windows/window1.js'
});

From docs: "url to a JavaScript file with the windows instructions. this window will create a new JavaScript sub-context that will run in its own thread and global variable space."

I think this sub-contexts info will help you understand them the most.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文