2017-07-08 60 views
0

我使用聚合物2.0样式模块(https://www.polymer-project.org/2.0/docs/devguide/style-shadow-dom#style-modules)。聚合物2.0样式模块共享样式在网页上打印CSS源

样式正在工作。然而,在Chrome浏览器中,css内容会打印到网页上,看起来像是乱码。在Firefox中完美工作。我如何在Chrome中解决这个问题?提前致谢。

以下是我有:

LBW-CSS-styles.html

<dom-module id="lbw-css-styles"> 
    <template> 
    <style> 
    :root { 
    background-color:green; 
... 
    </style> 
    </template> 
</dom-module> 

页的test.html

<link rel="import" href="bower_components/polymer/polymer.html"> 
<link rel="import" href="bower_components/polymer/polymer-element.html"> 
<link rel="import" href="lbw-css-styles.html"> 

<dom-module id="page-test"> 
    <template> 
    <style include="lbw-css-styles"> 
... 
    </style> 
    </template> 

    <script> 
    Polymer({ 
     is: 'page-test', 
    </script> 
</dom-module> 

回答

0

想通了。我的css引用了一个“:root”选择器,现在在聚合物2.0中已弃用它。删除弃用的选择器可解决问题。