2016-10-19 25 views
0

我剛開始與網絡的發展,我想用一些高分子元素(Plunker!):第一步用聚合物,元素不能正確顯示

http://embed.plnkr.co/o4OKkE/

我是那種一半管理進口。元素顯示(以某種方式)。除了利潤空間之外,紙件運作良好。按鈕很好,紙張輸入完全失敗,與標籤相同。文本/格式是默認的。聚合物是否指定字體等,還是使用CSS分別管理?

我想我沒有正確地附上主題。任何人都可以指出錯誤嗎?


編輯:感謝尼爾·約翰Ramal,我有沒有任何錯誤的工作基礎:

http://run.plnkr.co/AD3ETQOsMwajnSBt/

我似乎無法得到的要素使用導入多吉特,只是rawgit。

此位置:

工作正常。然而,這會產生一個錯誤:

Redirect at origin ' http://polygit.org ' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://run.plnkr.co ' is therefore not allowed access.

大概是因爲Plunker是不允許重定向,這就是如何polygit作品。它如何與polymer.html功能我不知道...

回答

1

你正在混合你的進口。您必須確保您從單一來源導入組件,以避免發生變量/名稱衝突。在你的例子中,你是從你自己的存儲庫和多邊形的進口。

證據是錯誤日誌:

VM199 polymer-micro.html:363 Uncaught NotSupportedError: Failed to execute 'registerElement' on 'Document': Registration failed for type 'dom-module'. A type with that name is already registered. 

這只是意味着你已經進口超過一次,並從不同的來源polymer.html更多。如果HTML來自同一個源,則只導入重複數據刪除。

此外,在您的index.html

<script data-require="[email protected]*" data-semver="1.0.0" src="http://polygit.org/components/polymer/polymer.html"></script> 

應該是:現在好多了

<link rel="import" src="//polygit.org/components/polymer/polymer.html"> 
+0

一切正常,但主題化似乎仍然沒有被施加(見編輯)。 – Joe