在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):PolymerElements/paper-badge开源软件地址(OpenSource Url):https://github.com/PolymerElements/paper-badge开源编程语言(OpenSource Language):HTML 58.8%开源软件介绍(OpenSource Introduction):<paper-badge>
See: Documentation, Demo. UsageInstallation
In an html file<html>
<head>
<script type="module">
import '@polymer/paper-badge/paper-badge.js';
import '@polymer/paper-button/paper-button.js';
import '@polymer/paper-icon-button/paper-icon-button.js';
import '@polymer/iron-icons/iron-icons.js';
import '@polymer/iron-icons/social-icons.js';
</script>
</head>
<body>
<div style="display:inline-block">
<span>Inbox</span>
<paper-badge label="3"></paper-badge>
</div>
<div>
<paper-button id="btn">Status</paper-button>
<paper-badge
icon="favorite"
for="btn"
label="favorite icon">
</paper-badge>
</div>
<div>
<paper-icon-button
id="account-box"
icon="account-box"
alt="account-box">
</paper-icon-button>
<paper-badge
icon="social:mood"
for="account-box"
label="mood icon">
</paper-badge>
</div>
</body>
</html> In a Polymer 3 elementimport {PolymerElement, html} from '@polymer/polymer';
import '@polymer/paper-badge/paper-badge.js';
import '@polymer/paper-button/paper-button.js';
import '@polymer/paper-icon-button/paper-icon-button.js';
import '@polymer/iron-icons/iron-icons.js';
import '@polymer/iron-icons/social-icons.js';
class SampleElement extends PolymerElement {
static get template() {
return html`
<div style="display:inline-block">
<span>Inbox</span>
<paper-badge label="3"></paper-badge>
</div>
<div>
<paper-button id="btn">Status</paper-button>
<paper-badge
icon="favorite"
for="btn"
label="favorite icon">
</paper-badge>
</div>
<div>
<paper-icon-button
id="account-box"
icon="account-box"
alt="account-box">
</paper-icon-button>
<paper-badge
icon="social:mood"
for="account-box"
label="mood icon">
</paper-badge>
</div>
`;
}
}
customElements.define('sample-element', SampleElement); Example: <div style="display:inline-block">
<span>Inbox</span>
<paper-badge label="3"></paper-badge>
</div>
<div>
<paper-button id="btn">Status</paper-button>
<paper-badge icon="favorite" for="btn" label="favorite icon"></paper-badge>
</div>
<div>
<paper-icon-button id="account-box" icon="account-box" alt="account-box"></paper-icon-button>
<paper-badge icon="social:mood" for="account-box" label="mood icon"></paper-badge>
</div> ContributingIf you want to send a PR to this element, here are the instructions for running the tests and demo locally: Installationgit clone https://github.com/PolymerElements/paper-badge
cd paper-badge
npm install
npm install -g polymer-cli Running the demo locallypolymer serve --npm
open http://127.0.0.1:<port>/demo/ Running the testspolymer test --npm |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论