您好我是使用Polymer.js的新手,我正在构建我的HTML自定义标签,以便在我的前端工作中重复使用它们。问题是当我尝试在Safari和Firefox中打开我的index.html时,我看到唯一没有CSS的HTML。在Chrome中一切都很完美。我无法理解为什么会这样。 我使用Polymer 1.0.0,Firefox和Safari都是最新版本。 有什么建议? 谢谢大家。
以下是代码(您注意到我已经包含了webcomponents-lite.min.js):
的index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<title>Polymer Project</title>
<script src="../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
<link rel="import" href="app/components/pd-dashboard/dashboard-articles.html" />
<div class="row">
<dashboard-articles> </dashboard-articles>
</div>
<div class="col-sm-2"></div>
</div>
</html>
dashboard-articles.html:
<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="import" href="../../components/articles/article-2col/article-2col.html">
<link rel="import" href="../../components/articles/article-1col/article-1col.html">
<link rel="stylesheet" type="css/text" href="../../components/pd-dashboard/dashboard-articles.css" />
<!-- Fonts -->
<link href='https://fonts.googleapis.com/css?family=Dosis:800,600,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Nunito:400,700' rel='stylesheet' type='text/css'>
<script src="../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
<dom-module id="dashboard-articles">
<template>
<div class="container-fluid">
<div class="row" style="margin: 5px">
</div>
<div class="row">
<hr>
<div class="row">
<div class="col-sm-5">
<article-1col></article-1col>
</div>
<div class="col-sm-7">
</div>
</div>
</div>
</template>
</dom-module>
<script>
Polymer({
is: "dashboard-articles"
});
</script>
答案 0 :(得分:0)
问题解决了!
{。1}}到.css文件必须位于您创建的每个组件的标记<link>
内!