npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@retailwe/ui-collapse

v0.0.18

Published

## 引入

Downloads

14

Readme

Collapse 折叠面板

引入

全局引入,在 miniprogram 根目录下的app.json中配置,局部引入,在需要引入的页面或组件的index.json中配置。

// app.json 或 index.json
"usingComponents": {
  "wr-Cell": "@retailwe/ui-collapse/index"
}

代码演示

基础用法

通过value控制展开的面板列表,activeNames为数组格式

<wr-collapse value="{{ activeNames }}" bind:change="onChange">
  <wr-collapse-item title="有赞微商城" name="1">
    提供多样店铺模板,快速搭建网上商城
  </wr-collapse-item>
  <wr-collapse-item title="有赞零售" name="2">
    网店吸粉获客、会员分层营销、一机多种收款,告别经营低效和客户流失
  </wr-collapse-item>
  <wr-collapse-item title="有赞美业" name="3" disabled>
    线上拓客,随时预约,贴心顺手的开单收银
  </wr-collapse-item>
</wr-collapse>
Page({
  data: {
    activeNames: ['1'],
  },
  onChange(event) {
    this.setData({
      activeNames: event.detail,
    });
  },
});

手风琴

通过accordion可以设置为手风琴模式,最多展开一个面板,此时activeName为字符串格式

<wr-collapse value="{{ activeName }}" bind:change="onChange" accordion>
  <wr-collapse-item title="有赞微商城" name="1">
    提供多样店铺模板,快速搭建网上商城
  </wr-collapse-item>
  <wr-collapse-item title="有赞零售" name="2">
    网店吸粉获客、会员分层营销、一机多种收款,告别经营低效和客户流失
  </wr-collapse-item>
  <wr-collapse-item title="有赞美业" name="3">
    线上拓客,随时预约,贴心顺手的开单收银
  </wr-collapse-item>
</wr-collapse>
Page({
  data: {
    activeName: '1',
  },
  onChange(event) {
    this.setData({
      activeName: event.detail,
    });
  },
});

自定义标题内容

<wr-collapse value="{{ activeNames }}" bind:change="onChange">
  <wr-collapse-item name="1">
    <view slot="title">有赞微商城<wr-icon name="question-o"/></view>
    提供多样店铺模板,快速搭建网上商城
  </wr-collapse-item>
  <wr-collapse-item title="有赞零售" name="2" icon="shop-o">
    网店吸粉获客、会员分层营销、一机多种收款,告别经营低效和客户流失
  </wr-collapse-item>
</wr-collapse>
Page({
  data: {
    activeNames: ['1'],
  },
  onChange(event) {
    this.setData({
      activeNames: event.detail,
    });
  },
});

API

Collapse Props

| 参数 | 说明 | 类型 | 默认值 | 版本 | | --------- | ------------------- | ---------------------------------------------------------------------- | ------- | ---- | | value | 当前展开面板的 name | 非手风琴模式:(string | number)[]手风琴模式:string | number | - | - | | accordion | 是否开启手风琴模式 | boolean | false | - | | border | 是否显示外边框 | boolean | true | - |

Collapse Event

| 事件名 | 说明 | 参数 | | ------ | -------------- | ------------------------------ | | change | 切换面板时触发 | activeNames: string | Array |

CollapseItem Props

| 参数 | 说明 | 类型 | 默认值 | 版本 | | --------- | ---------------------------------------------------------- | ------------------ | ------- | ---- | | name | 唯一标识符,默认为索引值 | string | number | index | - | | title | 标题栏左侧内容 | string | number | - | - | | icon | 标题栏左侧图标名称或图片链接,可选值见 Icon 组件 | string | - | - | | value | 标题栏右侧内容 | string | number | - | - | | label | 标题栏描述信息 | string | - | - | | border | 是否显示内边框 | boolean | true | - | | is-link | 是否展示标题栏右侧箭头并开启点击反馈 | boolean | true | - | | clickable | 是否开启点击反馈 | boolean | false | - | | disabled | 是否禁用面板 | boolean | false | - |

CollapseItem Slot

| 名称 | 说明 | | ---------- | ----------------------------- | | - | 面板内容 | | value | 自定义显示内容 | | icon | 自定义icon | | title | 自定义title | | right-icon | 自定义右侧按钮,默认是arrow |

Collapse 外部样式类

| 类名 | 说明 | | ------------ | ------------ | | custom-class | 根节点样式类 |

CollapseItem 外部样式类

| 类名 | 说明 | | ------------- | ------------ | | custom-class | 根节点样式类 | | content-class | 内容样式类 |