當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Dart Window.top用法及代碼示例

dart:html 庫中Window.top 屬性的用法介紹如下。

用法:

WindowBase? top
override

對窗口層次結構中最頂層窗口的引用。

如果此 WindowBase 是最頂部的 WindowBase ,則 top 將返回對 WindowBase 本身的引用。

// Add an IFrame to the current window.
IFrameElement myIFrame = new IFrameElement();
window.document.body.elements.add(myIFrame);

// Add an IFrame inside of the other IFrame.
IFrameElement innerIFrame = new IFrameElement();
myIFrame.elements.add(innerIFrame);

print(myIframe.contentWindow.top == window) // 'true'
print(innerIFrame.contentWindow.top == window) // 'true'

print(window.top == window) // 'true'

相關用法


注:本文由純淨天空篩選整理自dart.dev大神的英文原創作品 top property。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。