我想在Meteor应用程序中使用Polymer作为UI。因此我添加了以下包:
ecwyne:polymer 1.0.2 Add Polymer Base to meteor Project
ecwyne:polymer-elements 1.0.3 Add Polymer-Elements to Meteor
首先加载核心元素似乎完美无瑕。但是当代码变得更复杂时,它开始运行得很慢,我在FF33中得到了这个错误:
mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create
Chrome也在放慢速度。 我的代码是:
<head>
<title>mali</title>
<link rel="import" href="bower_components/core-header-panel/core-header-panel.html">
<link rel="import" href="bower_components/core-toolbar/core-toolbar.html">
<link rel="import" href="bower_components/core-icon-button/core-icon-button.html">
<link rel="import" href="bower_components/core-card/core-card.html">
</head>
<body>
<style>
#design_host {
position: absolute;
width: 100%;
height: 100%;
box-sizing: border-box;
}
#core_header_panel {
width: 100%;
height: 100%;
left: 0px;
top: 0px;
position: absolute;
}
#core_toolbar {
background-color: rgb(79, 125, 201);
color: rgb(255, 255, 255);
}
#section {
height: 1000px;
background: linear-gradient(rgb(214, 227, 231), lightblue) repeat scroll 0% 0% transparent;
}
#core_card {
position: absolute;
width: 300px;
height: 300px;
background-color: rgb(255, 255, 255);
border-radius: 2px;
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.098), 0px 0px 3px rgba(0, 0, 0, 0.098);
left: 330px;
top: 186px;
}
</style>
<core-header-panel mode="standard" id="core_header_panel">
<core-toolbar id="core_toolbar">
<core-icon-button icon="menu" id="core_icon_button"></core-icon-button>
<div id="div">MALI</div>
</core-toolbar>
<section id="section">
<core-card id="core_card">
</core-card>
</section>
</core-header-panel>
</body>
答案 0 :(得分:0)
这可能是由于HTTP请求太多。在差异化工作中,这些人创建了一个包装,它包装了硫化npm包,用于将Web组件处理成单个输出文件。
你可以通过添加包来试试:差异:硫化
meteor add differential:vulcanize
更多信息位于:https://atmospherejs.com/differential/vulcanize和http://differential.com/blog/meteor-polymer
希望它有所帮助,
干杯!