How do I get this JSFiddle显示其
<paper-dialog>
元素?请提供有效的JSFiddle或JSBin示例。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base href="http://element-party.xyz/">
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="all-elements.html">
</head>
<body>
<paper-button data-dialog="dialog">Dialog</paper-button>
<paper-dialog id="dialog">
<h2>Dialog Title</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
</paper-dialog>
</body>
</html>
答案 0 :(得分:1)
如果您只想静态查看对话框,可以在HTML(fiddle)中添加openend
属性。
<paper-dialog id="dialog" opened>
要在点击时打开,请调用open
函数(fiddle)。
<paper-button id="dialog-button" data-dialog="dialog">Dialog</paper-button>
<paper-dialog id="dialog">
<h2>Dialog Title</h2>
</paper-dialog>
<script>
document.querySelector("#dialog-button").addEventListener("click",
function(){
document.querySelector("#dialog").open();
});
</script>
答案 1 :(得分:0)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Polymer Bin</title>
<base href="http://element-party.xyz/">
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="all-elements.html">
</head>
<body>
<paper-button id="dialog-button" data-dialog="dialog">Dialog</paper-button>
<paper-dialog id="dialog" modal>
<h2>Dialog Title</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
</paper-dialog>
<script>
document.querySelector("#dialog-button")
.addEventListener("click", function(){
document.querySelector("#dialog").open()
});
</script>
</body>
</html>
答案 2 :(得分:0)
这是使用聚合物CDN的工作方式。它基于上面的答案。脚本标签似乎不是惯用的聚合物代码。
https://jsfiddle.net/bncg3qy8/
def t_comment(self, t):
r'(/\*(.|\n)*?\*/)|(//.*)'
t.lineno += t.value.count('\n')