0
我的webcomponent未顯示。 Chrome確實支持這個權利?我的webcomponent未顯示
我嘗試過使用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>