【问题标题】:Simplest possible HTML page with Polymer Paper Elements使用 Polymer Paper 元素的最简单的 HTML 页面
【发布时间】:2015-11-11 18:09:13
【问题描述】:

如何使用 Polymer Paper Elements 创建最简单的 html 页面?

我想要一个 html 文件,它可以从其他地方 (CDN) 加载所有必需的库。示例:

<!DOCTYPE html>
<html>
  <head>
    <title>Polymer Test</title>
  </head>
  <body>
    <paper-button>hello world paper button</paper-button>
  </body>
</html>

这显然不起作用,因为浏览器不知道&lt;paper-button&gt;。那么我必须包含哪些内容才能使其在所有当前浏览器上运行?

是否可以不自己下载任何库并将它们放在我的 html 文件旁边的网络服务器上?

【问题讨论】:

    标签: polymer web-component polyfills


    【解决方案1】:

    您可以使用 Polygit 类似 CDN 的 Polymer 工具

    <!doctype html>
    <html>
      <head>
        <meta charset="utf-8">
        <title>Polymer Simple</title>
    
        <base href="http://polygit.org/polymer+:master/components/">
    
        <script src="webcomponentsjs/webcomponents-lite.min.js"></script>
        <link href="polymer/polymer.html" rel="import">
        <link rel="import" href="paper-button/paper-button.html">
      </head>
      <body>
        <paper-button raised> Hello World!</paper-button>
      </body>
    </html>
    

    这里是 codepen 和 polygit,你可以 fork 工具包

    【讨论】:

    • 这对我不起作用,polygit.org 现在告诉我“Polygit 已弃用,仅与...兼容”。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-24
    • 1970-01-01
    • 2015-02-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多