【发布时间】:2015-06-01 20:48:55
【问题描述】:
我正在通过创建一个简单的自定义元素(ui 按钮)来使用 Polymer 1.0。
<link rel="import" href="../../../../bower_components/polymer/polymer.html">
<dom-module id="ui-button">
<link rel="import" type="css" href="ui-button.css">
<template>
<button class="ui button">
<template is="dom-if" if="{{icon}}"><i class="icon">1</i></template>
<template is="dom-if" if="{{label}}">{{label}}</template>
</button>
</template>
</dom-module>
<script src="ui-button.js"></script>
在 Chrome 中一切正常,但在 Firefox 中,按钮没有样式。 我的猜测是问题出在外部样式表上,因为当我将 CSS 内联(样式标签)...它可以工作。
这是 Polymer 1.0 中的错误吗? 我真的很想使用外部样式表...
【问题讨论】:
-
polymer-project.org/1.0/docs/devguide/styling.html 说它目前是一个“实验性功能”,所以我怀疑这是一个错误。或者,我会尝试将您的 CSS 放在带有
<style>标签的单独文件中,并将其作为常规 HTML 导入导入,而不是type="css"。