@anypoint-web-components/anypoint-button

中文文档
1.2.4发布于 2021/10/15Apache-2.0ESM + CJS近 30 天下载 3430

任意点的按钮.

中文使用文档
文档目录7 节
  1. 使用量
  2. 安装
  3. 在 HTML 文档中
  4. 在一个LitElement中
  5. 发展
  6. 本地运行演示
  7. 运行测试

折旧

此组件已移至 anypoint-web-components/awc。 。 。 .

====

任意点和材料设计按键.

默认情况下任意点按钮为任意点平台的样式. 样式可以通过使用 emphasis 属性 ans CSS 变量.

emphasis 可以成为其中之一 low, (中文(简体) ), middle,或 high。可以使用 CSS 变量重新定义每种样式. 低强调按钮应用于不太重要的行动. 次要行动应有中度强调. 首要行动应受到高度重视,而不是经常,最好是每屏一次.

Published on NPM

tests

使用量

安装

npm install @anypoint-web-components/anypoint-button --save

在 HTML 文档中

<script type="module" src="@anypoint-web-components/anypoint-button/anypoint-button.js"></script>
<script type="module" src="@anypoint-web-components/anypoint-button/anypoint-icon-button.js"></script>

<anypoint-button emphasis="low">Low emphasis</anypoint-button>
<anypoint-button emphasis="medium">Medium emphasis</anypoint-button>
<anypoint-button emphasis="high">High emphasis</anypoint-button>
<anypoint-button toggles>Button that toggles</anypoint-button>
<anypoint-button disabled>You can't click me</anypoint-button>

<anypoint-icon-button emphasis="low">
  <my-icon icon="alarm-add"></my-icon>
</anypoint-icon-button>

在一个LitElement中

import { LitElement, html } from 'lit-element';
import '@anypoint-web-components/anypoint-button/anypoint-button.js';
import '@anypoint-web-components/anypoint-button/anypoint-icon-button.js';

class SimpleElement extends LitElement {
  render() {
    return html`
    <anypoint-button emphasis="low">Low emphasis</anypoint-button>
    <anypoint-button emphasis="medium">Medium emphasis</anypoint-button>
    <anypoint-button emphasis="high">High emphasis</anypoint-button>
    <anypoint-button toggles>Button that toggles</anypoint-button>
    <anypoint-button disabled>You can't click me</anypoint-button>

    <anypoint-icon-button emphasis="low">
      <my-icon icon="alarm-add"></my-icon>
    </anypoint-icon-button>
    `;
  }
}
window.customElements.define('simple-element', SimpleElement);

发展

git clone https://github.com/anypoint-web-components/anypoint-button
cd anypoint-button
npm install

本地运行演示

npm start

运行测试

npm test

版本与发布记录

@anypoint-web-components/anypoint-button 共发布 23 个版本,首次发布于 2019/06/24;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.2.4latest2021/10/155 年前
1.2.32021/09/025 年前
1.2.22021/07/085 年前
1.2.12021/05/315 年前
1.2.02021/01/305 年前
1.1.12020/05/076 年前

关于 @anypoint-web-components/anypoint-button 的常见问题

@anypoint-web-components/anypoint-button 是什么?

任意点的按钮.

如何安装 @anypoint-web-components/anypoint-button?

在项目目录运行 npm install @anypoint-web-components/anypoint-button,或使用 pnpm add / yarn add / bun add。

@anypoint-web-components/anypoint-button 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/anypoint-web-components__anypoint-button 是否存在。

@anypoint-web-components/anypoint-button 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@anypoint-web-components/anypoint-button 可以商用吗?

@anypoint-web-components/anypoint-button 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@anypoint-web-components/anypoint-button 的下载量有多少?

根据 npm 官方下载统计,@anypoint-web-components/anypoint-button 在 2026/10/06 – 2026/11/04 这 30 天内被下载 3,430 次,日均约 114 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@anypoint-web-components/anypoint-button 还在维护吗?

最新版本 1.2.4 发布于 2021/10/15(5 年前);至今共发布 23 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/06/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。