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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@retailwe/ui-dialog

v0.0.23

Published

## 引入

Downloads

27

Readme

Dialog 弹出框

引入

"usingComponents": {
  "wr-dialog": "@retailwe/ui-dialog/index"
}

代码演示

基础用法

用于提示一些消息,只包含一个确认按钮

<wr-dialog
  show="{{show3}}"
  message="{{message}}"
  bindconfirm="confirm"
  showCancelButton="{{showCancelButton}}"
>
</wr-dialog>
Page({
  data: {
    show1: false,
    show2: false,
    show3: false,
    show7: false,
    show6: false,
    title: '标题',
    message: '弹框内容message',
    showCancelButton: true,
  },
  handleTap(e) {
    const { index } = e.currentTarget.dataset;
    if (index == 5) {
      Dialog.confirm({
        title: '标题',
        message: '编程式调用可以方便的回调~',
      })
        .then(() => {
          Toast({
            icon: 'success',
            text: '回调: 确定',
          });
        })
        .catch(() => {
          Toast({
            text: '回调: 取消',
          });
        });
    } else {
      this.setData({
        ['show' + index]: true,
      });
    }
  },
  dailogClose() {
    this.setData({
      show6: false,
    });
  },
});

API

Props

通过组件调用 Dialog 时,支持以下 Props:

| 参数 | 说明 | 类型 | 默认值 | | ----------------- | -------------------------- | --------------------------------- | ---------- | | show | 是否显示弹窗 | boolean | - | | title | 标题 | string | - | | message | 文本内容,支持通过\n换行 | string | - | | textAlign | message 的文本对齐方式 | 'center'|'left'|'right' | 'center' | | z-index | z-index 层级 | number | 100 | | showConfirmButton | 是否展示确认按钮 | boolean | true | | showCancelButton | 是否展示取消按钮 | boolean | false | | confirmButtonText | 确认按钮的文案 | string | 确认 | | cancelButtonText | 取消按钮的文案 | string | 取消 | | confirmOpenTypeValue | 确认按钮微信开放能力,可参考微信文档 | string | | |asyncClose|是否支持异步关闭弹窗,开启后需要手动关闭弹窗|boolean| false| | direction | 按钮排列方式 | _'row'|'column' | 'row' | | actions | 按钮列表 | array | - |

// `actions` props:
interface Action {
  name: string; // 按钮文案
  primary?: boolean; // 是否主要按钮(颜色与其他按钮不同)
  style?: string; // 自定义样式
}

Events

| 事件 | 说明 | 回调参数 | | ----------- | ------------------ | -------- | | bindconfirm | 点击确认按钮时触发 | - | | bindcancel | 点击取消按钮时触发 | - |