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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mas.io/adc-page-container

v1.0.0

Published

@alipay/adc-page-container 的组件描述

Downloads

8

Readme

安装

tnpm install --save @alipay/adc-page-container

组件介绍

行业小程序页面骨架屏效果组件,在需要等待加载内容的位置提供一个占位图形组合, 加载内容异常时显示异常图标占位符,此异常页面是增强了 小程序开发组件拓展组件 Page-result 异常页组件的功能:用户可以自定义异常页面的图标

参数说明

| 属性 | 必填 | 参数类型 | 参数说明 | 默认值 | 示例 | | ------------------ | ---- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------ | | className | 否 | string | 自定义样式名称 | -- | -- | | exceptionClassName | 否 | string | 异常页面的自定义样式 | -- | exceptionClassName | | type | 否 | string | 异常页面类型, 可选值:加载失败 default,网络异常 network,服务繁忙 busy,服务异常 error,空状态 empty,用户注销 logoff,付款失败 payment,红包领空 redpacket | default | network | | local | 否 | boolean | 是否是局部异常内容 | false | false | true | | title | 否 | string | 错误提示标题(最多一行) | 默认文案 | 数据加载失败 | | brief | 否 | string | 错误提示简要(最多两行) | 默认文案 | 待会来试试 | | footer | 否 | Array[{text}] | 错误处理按钮文案(一个或两个按钮) | -- | [{ text:'刷新'},{text:'重试'}] | | onTapLeft | 否 | EventHandle | (左侧)按钮事件处理函数 | () =>{} | (e)=>{console.log(e)} | | onTapRight | 否 | EventHandle | (右侧)按钮事件处理函数 | () =>{} | (e)=>{console.log(e)} | | isCountDown | 否 | boolean | 是否设置倒计时模式 | false | true | | countDownText | 否 | string | 倒计时提示的文案 | -- | 重新刷新 | | countDownTimes | 否 | number | 倒计时时间, 单位: 秒 | 5 | 3 |

Slot

| Name | 说明 | 是否必传 | | ------- | -------- | -------- | | default | 页面内容 | 是 |

在小程序中使用

{
  "usingComponents": {
    "mas-adc-page-container": "@alipay/adc-page-container/es/index"
  }
}

在 page.axml 中引用组件

<mas-adc-page-container 
loading="{{loading}}"
skeletonShowTitle="{{skeletonShowTitle}}"
skeletonShowAvatar="{{skeletonShowAvatar}}"
skeletonRow="{{skeletonRow}}"
expError="{{expError}}"
onTapLeft="reLoadData"
onTapRight="reLoadData"
footer="{{footer}}"
type="{{type}}"
isCountDown
countDownText="刷新文本"
countDownTimes="{{7}}"
> 
  <view>
    我是页面加载的数据.....
  </view>
</mas-adc-page-container> 

在page.js 中需要注册方法

Page({
  data: {
    skeletonShowTitle: true,
    skeletonShowAvatar: false,
    skeletonRow: 10,
    expError: false,
    loading: true,
    footer: [{
      text: '刷新',
    }],
    type: 'default',
    types: ['default', 'network', 'busy', 'error', 'empty', 'logoff', 'payment', 'redpacket'],
  },
  onLoad() {
    this.loadData();
  },
  onTapExpBtn() {
    this.reLoadData();
  },
  loadData() {
    setTimeout(() => {
      this.setData({
        loading: false,
        expError: true,
      });
    }, 1000);
  },
  reLoadData() {
    this.setData({
      loading: true,
      expError: false,
    });
    setTimeout(() => {
      this.setData({
        loading: false,
        expError: true,
        type: this.data.types[Math.floor(Math.random() * 7)],
      });
    }, 1000);
  },

});

Tip

  • footer 中定义按钮的文案,配合 onTapLeftonTapRight 方法,分别对应 footer[0] 和 footer[1] 的按钮实例(若只有一个按钮,只需定义 onTapLeft 属性)。
  • 如需将操作按钮设置倒计时模式(仅一个按钮),可配置 isCountDown 属性,默认文案为 5 秒后重新刷新,可通过 countDownText 配置替代 重新刷新 文案。
  • 设置了倒计时模式,需要配合 footeronTapLeftonTapRight 属性定义倒计时后的处理按钮。

Badges

TNPM version TNPM downloads