【问题标题】:My webcomponent is not showing我的网络组件没有显示
【发布时间】:2012-10-24 07:53:48
【问题描述】:

我的 web 组件没有显示。 Chrome 确实支持这个吗?

我已经使用is 属性和Javascript 进行了尝试。两者都不起作用。

索引(头部):

        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="js/jquery/jqueryMobile/jquery.mobile-1.2.0.css" />
        <script src="js/jquery/jquery-1.8.2.js"></script>
        <script src="js/jquery/jqueryMobile/jquery.mobile-1.2.0.js"></script>
        <link rel="components" href="x-mycomp.html"/>
        <script>
            var el = document.createElement('x-mycomp');
            alert(el); // shows: [object HTMLUnkownElement]
        </script>

索引(正文):

    <div id="page1" data-role="page">
        <div is="x-mycomp"></div>

    </div>

x-mycomp.html:

<element extends="div" name="x-mycomp">
    <template>
        <content>
            <div>
                <div data-role="header">
                    <div>
                        Log in
                    </div>
                    <a id="bt_register" data-role="button">register</a>
                </div>
                <div data-role="content">
                    <form>
                        <input id="username" placeholder="username" type="text"/>
                        <input id="password" placeholder="password" type="password"/>
                        <a id="bt_login" data-role="button">Log in</a>
                    </form>
                </div>
            </div>
        </content>
    </template>
</element>

【问题讨论】:

    标签: html web-component


    【解决方案1】:

    Chrome 尚不支持此功能。所以在那之前这是正确的答案。

    【讨论】:

      猜你喜欢
      • 2013-03-17
      • 1970-01-01
      • 2020-12-27
      • 1970-01-01
      • 2017-09-11
      • 2023-01-19
      • 2020-01-09
      • 2023-02-11
      • 1970-01-01
      相关资源
      最近更新 更多