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

leprechaun-uni

v1.0.4

Published

uni-app工具包

Downloads

7

Readme

leprechaun-vue

  • leprechaun-vue 搭配 uView 组件库通用方法

fileMixin

处理文件上传及下载

chooseFile

选择文件或图像

| 参数 | 描述 | 必填 | 默认 | 可选 | | :---: | :---------------------: | :--: | :---: | :---------: | | key | form 对象对应文件字段名 | 是 | | | | type | 选择文件的类型 | 否 | image | image、file | | count | 最多上传个数 | 否 | 9 |

deleteFile

删除文件或图像

| 参数 | 描述 | 必填 | 默认 | 可选 | | :------: | :---------------------: | :--: | :--: | :--: | | key | form 对象对应文件字段名 | 是 | | | | filePath | 文件 path | 是 | | |

uploadFile

上传文件

  • 需要先配置 uploadUrl(上传文件路径)和 Authorization(接口 token)

| 参数 | 描述 | 必填 | 默认 | 可选 | | :--: | :------------: | :--: | :--: | :--: | | file | 需要上传的文件 | 是 | | |

// 上传文件
for (let field in this.MIXIN_needUploadFiles) {
  this.form[field] = "";
  for (let i = 0; i < this.MIXIN_needUploadFiles[field].length; i++) {
    const fileName = await this.uploadFile(
      this.MIXIN_needUploadFiles[field][i]
    );
    this.form[field] = this.form[field]
      ? this.form[field] + `,${fileName}`
      : fileName;
  }
}

handlerDown

文件下载

| 参数 | 描述 | 必填 | 默认 | 可选 | | :------: | :-------: | :--: | :--: | :--: | | filePath | file 路径 | 是 | | |

listMixin

用于列表加载

  • 例子
<scroll-view class="list" @scrolltolower="handlerLoadingMore()" scroll-y>
  <view class="UnionBox" v-for="(item,index) in MIXIN_list" :key="index">
    <UnionItem
      :item="item"
      :dictObject="MIXIN_dictObject.member_position"
    ></UnionItem>
  </view>
</scroll-view>
	async initData() {
		uni.showLoading()
		let params = {
			pageNum: this.MIXIN_pageNum, // 当前页数
			pageSize: 10, // 每页显示记录数
			orderByColumn: 'createTime', // 排序列名称
			isAsc: 'desc' // 排序的方向 "desc" 或者 "asc"
		}
		let url = this.$store.getters.api.memberApplyAuditList + this.$u.queryParams(params, true, 'repeat');
		const {
			rows,
			total
		} = await this.$http(url, {}, 'POST', '', true)
		this.handlerList(rows, total)
		uni.hideLoading()
	}

handlerLoadingMore

加载更多

handlerList

处理列表数据

formMixin

处理 uView 表单组件

pickerConfirm

普通选择器回调

<u-form-item
  label="民族"
  v-if="MIXIN_dictObject.sys_nation"
  prop="nation"
  borderBottom
  required
  @click="nation_show=true"
>
  <view style="margin-left: 20rpx;">
    {{form.nation?MIXIN_dictObject.sys_nation[form.nation]:'请选择民族'}}
  </view>
  <u-picker
    :defaultIndex="[findPickerIndex(MIXIN_dict.sys_nation,form.nation)]"
    :show="nation_show"
    :columns="MIXIN_dict.sys_nation"
    @confirm="(e)=>pickerConfirm('nation',e)"
    @cancel="nation_show= false"
    keyName="label"
  >
  </u-picker>
  <u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>

dateTimePickerConfirm

日期选择器确认回调

<u-form-item
  label="出生年月"
  prop="nation"
  borderBottom
  required
  @click="birthday_show=true"
>
  <view style="margin-left: 20rpx;"> {{form.birthday||'请选择出生年月'}} </view>
  <u-datetime-picker
    :minDate="-1577952000000"
    :show="birthday_show"
    :value="form.birthday||MIXIN_today"
    mode="date"
    @confirm="(e)=>datetimePickerConfirm('birthday',e,'YYYY-MM-DD')"
    @cancel="birthday_show= false"
  >
  </u-datetime-picker>
  <u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>

findPickerIndex

picker 默认下标

<u-form-item
  label="民族"
  v-if="MIXIN_dictObject.sys_nation"
  prop="nation"
  borderBottom
  required
  @click="nation_show=true"
>
  <view style="margin-left: 20rpx;">
    {{form.nation?MIXIN_dictObject.sys_nation[form.nation]:'请选择民族'}}
  </view>
  <u-picker
    :defaultIndex="[findPickerIndex(MIXIN_dict.sys_nation,form.nation)]"
    :show="nation_show"
    :columns="MIXIN_dict.sys_nation"
    @confirm="(e)=>pickerConfirm('nation',e)"
    @cancel="nation_show= false"
    keyName="label"
  >
  </u-picker>
  <u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>