试图通过凉亭安装聚合物纤维

问题描述 投票:0回答:1

凉亭和网络组件的新功能。我正在尝试用凉亭安装polymer-quill library

npm install -g bower
mkdir polymerquill
cd polymerquill
bower install --save polymer-quill

现在我有一个完整的bower_components目录。我制作一个index.html文件并添加以下内容:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
    <link rel="import" href="bower_components/polymer-quill/polymer-quill.html">
</head>
<body>
    <h1>PolyQuill</h1>
    <style is="custom-style">
      polymer-quill.full {
        --polymer-quill-editor-max-height: 300px;
        --polymer-quill-editor-min-height: 100px;
      }
    </style>
    <h2>Full Toolbar, Show Results, Max Height (300px), Min Height (100px), Save as Deltas, Save every 1 second</h2>
    <polymer-quill content='{"ops":[{"insert":"Hello World! - Store as Delta"},{"attributes":{"header":2},"insert":"\n"}]}'
      class='full'
      store-as="delta"
      save-interval="1000"
      toolbar-type="full"
      show-results>
    </polymer-quill>
    <h2>Standard Toolbar, Hide Results, Default height (100px), Save as HTML, Save every 2 seconds</h2>
    <polymer-quill content="<h2>Hello World! - Store as HTML</h2>" store-as="html"></polymer-quill>
</body>
</html>

然而,当我在Chrome中打开它时,我只看到h2的。 polymer-quill元素不呈现。我忘了做什么?

polymer bower polyfills quill
1个回答
1
投票

我相信这个元素目前只适用于Polymer的shady DOM(参见问题here)。

如果您使用的是Polymer 1.0,请在index.html中添加以下脚本来声明shady DOM:(reference

<script>
  /* this script must run before Polymer is imported */
  window.Polymer = {
    dom: 'shadow',
    lazyRegister: true
  };
</script>

如果您使用的是Polymer 2.0,则在导入webcomponents时,只需添加shadydom属性,如下所示:

<script src="webcomponentsjs/webcomponents-loader.js" shadydom></script>
© www.soinside.com 2019 - 2024. All rights reserved.