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

manniu-uikit-common-picker

v1.0.5

Published

```javascript const CONSTANT_COMPONENT_TYPE = { HEART_RATE: 'HEART_RATE', //心率 BLOOD_PRESSURE: 'BLOOD_PRESSURE', //血压 SWIMMING_TIME: 'SWIMMING_TIME', //游泳时长 EDUCATION: 'EDUCATION', //学历 GENDER: 'GENDER', //性别 RELATIONSHIP:

Downloads

3

Readme

控件支持的组件选项类型

  const CONSTANT_COMPONENT_TYPE = {
    HEART_RATE: 'HEART_RATE', //心率
    BLOOD_PRESSURE: 'BLOOD_PRESSURE', //血压
    SWIMMING_TIME: 'SWIMMING_TIME', //游泳时长
    EDUCATION: 'EDUCATION', //学历
    GENDER: 'GENDER', //性别
    RELATIONSHIP: 'RELATIONSHIP', //亲属关系
    PREGNANCY_PLANNING: 'PREGNANCY_PLANNING', //备孕计划
    LATELY_DAYS: 'LATELY_DAYS', //最近天数
    HEIGHT: 'HEIGHT', //身高
    WEIGHT: 'WEIGHT', //体重
    FAT_RATE: 'FAT_RATE', //体脂率
    HIPLINE: 'HIPLINE', //臀围
    TEMPERATURE: 'TEMPERATURE', //体温
    BLOOD_GLUCOSE: 'BLOOD_GLUCOSE', //血糖
    BMI: 'BMI', //体重指数
  }

效果展示

单列控件样式效果
心率 双列控件样式效果
身高

代码示例

  • 页面引入组件并添加监听事件
  <!-- 通用选择器 -->
  <common-picker
    ref="common-picker"
    @confirm="pickerConfirm"
    @cancel="onPickerCancel"
    @change="onPickerChange"
  />
  • 页面点击选择控件
  <van-field
    v-model="formParams.heart_rate"
    label="心率"
    placeholder="请选择心率"
    input-align="right"
    readonly
    @click="handleChoosePicker('HEART_RATE','heart_rate')"
  />
  • 监听事件及代码处理
  // 选择控件
  handleChoosePicker(type, key) {
    this.$refs['common-picker'].handleChoosePicker(type, key);
  // this.$refs['common-picker'].chooseItem({
  //   type:type,
  //   extraData:{
  //     key,
  //   }
  // });
  },
  // 确认
  pickerConfirm(data) {
    console.log(data);
    const value = data.combinedValue;
    const key = data.extraData.key;
    this.formParams[key] = value;
  },
  onPickerChange(data) {
    console.log(data);
  },
  onPickerCancel(data) {
    console.log(data);
  },
  • 代码说明
    ① handleChoosePicker(type, key) 方法接收两个参数,参数一表示选择的控件类型枚举值,参数二用于用户自定义数据,在点击确认后,将会原值返回回来
    ② pickerConfirm(data) 监听确认方法,方法返回数据格式如下

    单列格式

    {
      pickData: [{ text: 20, value: 20 }, 0],
      combinedValue: 20,
      type: 'HEART_RATE',
      extraData: { key: 'heart_rate' },
    }

    双列格式

    {
      pickData: [
        [
          { text: 0, value: 0 },
          { text: '.0', value: 0 },
        ],
        [0, 0],
      ],
      combinedValue: '0.0',
      type: 'HEIGHT',
      extraData: { key: 'height' },
    }

    其中 pickData 字段为vant组件返回的数据 ,combinedValue为选择的多列的字段值按照 '.' 拼接起来的值,type值为控件类型枚举值,extraData为用户传递的自定义数据