编译错误:在 HTML 上下文元素中找到小部件

发布于 2024-09-12 22:09:57 字数 1041 浏览 1 评论 0原文

我已经看到这个答案但我可以看不出我自己的代码中可能存在什么问题。这是我的 uibinding xml:

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:a='urn:import:com.google.gwt.app.client'>
    <ui:style field='iphone' src='Render.css' />        
<div id='iHeader'>
    <div
        style='display:block; opacity:1; -webkit-tranform:translate3d(0px, 0px, 0px);'>
        <a>
            <span id='waHeadTitle'
                style='display:block; -webkit-tranform:translate3d(0px, 0px, 0px);'>
                <g:HTML ui:field="title" />
            </span>
        </a>
    </div>
</div>
</ui:UiBinder>

然后我收到错误消息: Found widget in an HTML context Element

I've seen this answer but my I can't see what could possibly be the problem in my own code. Here is the my uibinding xml:

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:a='urn:import:com.google.gwt.app.client'>
    <ui:style field='iphone' src='Render.css' />        
<div id='iHeader'>
    <div
        style='display:block; opacity:1; -webkit-tranform:translate3d(0px, 0px, 0px);'>
        <a>
            <span id='waHeadTitle'
                style='display:block; -webkit-tranform:translate3d(0px, 0px, 0px);'>
                <g:HTML ui:field="title" />
            </span>
        </a>
    </div>
</div>
</ui:UiBinder>

Then I get the error message: Found widget in an HTML context Element <g:HTML ui:field='title'>

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

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

发布评论

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

评论(1

一杆小烟枪 2024-09-19 22:09:57

问题在于该小部件的根元素是 div。我认为只要整个小部件是纯 HTML 就可以了,但是如果您想混合 HTML 和小部件,根必须是 HTMLPanel。

The problem was that the root element of the widget was a div. I think that's fine as long as the whole widget is pure HTML, but if you want to mix HTML and widgets, the root has to be HTMLPanel.

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