我正在尝试将Polymer集成到我的Laravel应用中。因此,我创建了这个自定义Web组件,并将其放入Laravel视图中时,只能看到空白屏幕。如果您认为这可能是HTML导入的问题,我正在使用Laravel的内置Web服务器。
proto-element.html
<link rel="import" href="../bower_components/polymer/polymer.html">
<polymer-element name="proto-element" noscript>
<template>
<h1>Proto element</h1>
</template>
</polymer-element>
hello.blade.php
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Laravel PHP Framework</title>
<script type="text/javascript" src="bower_components/webcomponentsjs/webcomponents.min.js"></script>
<script type="text/javascript">
function supportsImports() {
return 'import' in document.createElement('link');
}
if (supportsImports()) {
// Good to go!
} else {
// Use other libraries/require systems to load files.
}
</script>
<link rel="import" href="elements/proto-element.html">
</head>
<body>
<proto-element></proto-element>
</body>
</html>
您在自定义元素的声明中使用的是0.5语法而不是1.0语法。这是您在1.0中的做法。
<dom-module id="proto-element">
<template>
<h1>Proto element</h1>
</template>
<script>
Polymer({
is: "proto-element"
});
</script>
</dom-module>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句