当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。