1
我非常非常新的聚合物,材料和Web組件聚合物2應用:紙按鈕沒有文字
我,所用聚合物CLI創建聚合物2應用
polymer init
然後我選擇了聚合物-2-初學者工具包
我嘗試一些paper buttons添加到我的廠景文件,但我發現紙按鈕沒有添加到涼亭的依賴關係,所以我自己添加了它。我bower.json看起來是這樣的:
{
"name": "my-app",
"authors": [
"Ehsun"
],
"license": "",
"dependencies": {
"app-layout": "PolymerElements/app-layout#2.0-preview",
"app-route": "PolymerElements/app-route#2.0-preview",
"iron-flex-layout": "PolymerElements/iron-flex-layout#2.0-preview",
"iron-icon": "PolymerElements/iron-icon#2.0-preview",
"iron-iconset-svg": "PolymerElements/iron-iconset-svg#2.0-preview",
"iron-localstorage": "PolymerElements/iron-localstorage#2.0-preview",
"iron-media-query": "PolymerElements/iron-media-query#2.0-preview",
"iron-pages": "PolymerElements/iron-pages#2.0-preview",
"iron-selector": "PolymerElements/iron-selector#2.0-preview",
"paper-icon-button": "PolymerElements/paper-icon-button#2.0-preview",
"polymer": "Polymer/polymer#^2.0.0-rc.1",
"webcomponentsjs": "webcomponents/webcomponentsjs#^1.0.0-rc.1",
"paper-button": "PolymerElements/paper-button#1.0.14"
},
"devDependencies": {
"web-component-tester": "6.0.0-prerelease.5"
},
"private": true
}
,我添加了標記,以我的觀點一個是這樣的:
<!--
@license
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../bower_components/polymer/polymer-element.html">
s<link rel="import" href="../bower_components/paper-button/paper-button.html">
<link rel="import" href="../bower_components/paper-styles/paper-styles.html">
<link rel="import" href="shared-styles.html">
<dom-module id="my-view1">
<template>
<style include="shared-styles">
:host {
display: block;
padding: 10px;
}
</style>
<div class="card pink" >
<h1>Start Now</h1>
<a href="/view2"><paper-button raised class="indigo">go</paper-button></a>
</div>
<paper-button class="pink">link</paper-button>
<paper-button raised class="indigo">raised</paper-button>
<paper-button toggles raised class="green">toggles</paper-button>
<paper-button disabled class="disabled">disabled</paper-button>
</template>
<script>
class MyView1 extends Polymer.Element {
static get is() {
return 'my-view1';
}
}
window.customElements.define(MyView1.is, MyView1);
</script>
</dom-module>
現在的按鈕無文字,如下所示:
您應該嘗試使用'paper-button'的'2.0-preview'分支。見[this](https://www.polymer-project.org/2.0/docs/about_20#elements)doc。 – a1626
謝謝。它現在有效。這是解決方案。如果你發佈這個答案,會很好。 – ehsun7b