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

mina-tool

v1.0.0

Published

小程序实用工具库,包含组件、wxs、behaviors、wxss几个维度

Downloads

4

Readme

mina-tool

小程序 开发实用工具集合
主要包含几个维度:

  1. 组件
  2. behaviors
  3. wxs
  4. 样式

安装

  1. npm install mina-tool
  2. 微信开发者工具编译 npm 包

组件

popup-window

快速实现全屏浮动弹窗

使用
{
  "usingComponents": {
    "popup-window": "mina-tool/components/popup-window"
  }
}
<popup-window
  selector="{{selector}}"
  id="popup-window"
  tap-bg-close="{{true}}"
  catch-scroll="{{true}}"
  scroll-bg-close="{{true}}"
  visible="{{true}}"
  background-color="rgba(0,0,0,0.4)"
>
  <!-- popup-window内部展示slot -->
</popup-window>

multi-picker

在小程序原生 picker - multiSelector 的基础上封装一层逻辑
feature:

  1. 封装一层中间选择状态,保证选择过程中不会 trigger 外部状态变化
  2. bindcancel 时自动将 picker 选择状态更新为外部状态,保证每次点开 picker 时的选中项和外部状态保持一致
  3. 通过 getRanges,函数式更新 range 值,代码更简洁
使用
{
  "usingComponents": {
    "multi-picker": "mina-tool/components/multi-picker"
  }
}
<multi-picker
  getRanges="{{getRanges}}"
  rangeKey="title"
  value="{{value}}"
  bindchange="{{onChange}}"
  bindcancel="{{onCancel}}"
>
  <!-- multi-picker内部展示slot -->
</multi-picker>

error-img

在 img 的 src 展示失败时,自动用 err 属性值更新 src 作为展示兜底

使用
{
  "usingComponents": {
    "error-img": "mina-tool/components/error-img"
  }
}
<error-img err="{{err_img_url}}" ...其他image属性 />

data-status

封装 数据请求展示过程中的一些状态展示:loading、empty、show_data

使用
{
  "usingComponents": {
    "data-status": "mina-tool/components/data-status"
  }
}
<data-status min-height="600rpx" loading="{{loading}}" empty="{{empty}}">
  <!-- data展示slot -->
</data-status>

wxs

format.wxs

展示格式化:formatNumber, formatTime

使用
<wxs src="mina-tool/wxs/format.wxs" module="format" />
...
<!-- 98.6万 -->
<view class="number">{{format.formatNumber(985800)}}</view>
<!-- 1.45亿 -->
<view class="number">{{format.formatNumber(145004545)}}</view>
<!-- 2021-01-04 -->
<view class="date">{{format.formatTime(1609756055278,'YYYY-MM-dd')}}</view>
...