GWT 用 RootPanel 替换 div(不是追加!)

发布于 2024-08-23 08:43:41 字数 272 浏览 4 评论 0原文

在 GWT 中,如果我执行 RootPanel.get("someDiv").add(myPanel); 我总是得到:

但是,我只想要 1 级层次结构,即

其中 someDiv 包含 myPanel。

有什么想法吗? 谢谢!

In GWT if I do RootPanel.get("someDiv").add(myPanel); I invariably get:
<div id="someDiv"><div></div></div>

But, I just want 1 level of hierarchy, i.e., <div id="someDiv"><div> where the someDiv contains myPanel.

Any ideas?
Thanks!

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

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

发布评论

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

评论(1

烟燃烟灭 2024-08-30 08:43:41

面板必须是 div(或表或跨度)。你的RootPanel是一个div,你添加到它的Panel也是一个div。

如果您正在编写一个全页应用程序,RootPanel.get() 返回该元素,因此向该元素添加一个 div 只会导致其中出现一个 div

但老实说,尝试摆脱应用程序中的一个 div 嵌套是不会为您节省任何明显的时间。

A Panel has to be a div (or table or span). Your RootPanel is a div, and the Panel you add to it is a div.

If you're writing a full-page app, RootPanel.get() returns the element, so adding a div to that will only result in one div inside the

But honestly, trying to get rid of one nesting of divs in your application is not going to save you any noticeable amount of time.

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