【问题标题】:Polymer doesn't work in IE or edge but in chrome it does, however with a Doctype it doesn't work in chrome eitherPolymer 在 IE 或 edge 中不起作用,但在 chrome 中可以,但是对于 Doctype,它在 chrome 中也不起作用
【发布时间】:2016-03-05 17:23:04
【问题描述】:

我的聚合物项目遇到了一些问题,如果我包含 <!doctype html>,我的代码在 IE、Edge 甚至 chrome 中都无法运行。这是我的代码:

<!doctype html>
<html>
  <head>
    <link rel="import" href="bower_components/paper-header-panel/paper-header-panel.html">
    <link rel="import" href="bower_components/paper-card/paper-card.html">
    <LINK REL=StyleSheet HREF="style.css" TYPE="text/css">
    <link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
    <link rel="import" href="bower_components/polymer/polymer.html">
  </head>
  <body>
    <paper-header-panel mode="standard" id>
      <paper-toolbar  style="background-color: some-color">
        <h1>Blah</h1>
      </paper-toolbar>
      <div id="content">
      <div class="center2">
        <h3>Blah Blah Blah<span id="orange">Blah Blah Blah</span></h3>
      </div>
      <paper-card heading="Blah Blah Blah" id="main">
        <div class="card-content">
        </div>
      </paper-card>
      <paper-card heading="Blah Blah Blah" id="main">
        <div class="card-content">
          <img src="img.png" height="200px" id="img"/>
          </br>
          Blah Blah Blah
        </div>
      </paper-card>
      </div>
    </paper-header-panel>
  </body>
</html>

任何帮助都会受到重视。谢谢!

【问题讨论】:

    标签: html polymer doctype polymer-1.0


    【解决方案1】:

    您需要 polyfill 才能在非 chrome 浏览器中工作。我不认为你在 chrome 中这样做了,但也许直到下一个版本你仍然这样做。

    <script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
    

    在开始导入任何其他内容之前在标题中

    【讨论】:

    • paper-header-panel 仅在其正下方采用两个元素,一个用于标题,一个用于您有很多的主要内容。我认为标题也需要高度。我认为 paper-toolbar 应该给你这个,但你能检查一下它有没有的开发工具。
    • 对不起,我已经用 div 包围了内容,但它仍然可以!
    猜你喜欢
    • 2019-10-02
    • 1970-01-01
    • 2015-03-31
    • 1970-01-01
    • 2017-10-01
    • 2020-06-04
    • 1970-01-01
    • 2012-01-23
    • 1970-01-01
    相关资源
    最近更新 更多