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

wepy-plugin-vant2

v1.0.6

Published

A wepy plugin for vant-weapp

Downloads

4

Readme

wepy-plugin-vant2

fork from wepy-plugin-vant 一个Vant的wepy插件 (其实就是把jardenliu/wepy-plugin-iview修改成了vant的,因为我觉得vant比较好用,如果侵权的话联系我我立刻删掉)

特性

  • 自动注入
  • 简易配置
  • px转换(rpx, rem, em, px)

用法

  1. 安装vant-app
  $ npm i vant-weapp -S
  1. 安装wepy-plugin-vant2
  $ npm i wepy-plugin-vant2
  1. wepy.config.jsplugins项中添加 vant2:{}
  plugins: {
    // ...
    vant2: {
    }
    // ...
  }
  1. 运行项目,即可使用Vant的全部组件啦~~ 如:<van-button></van-button>

全局注入配置

默认是在pages目录下的所有页面的usingComponents中,自动注入全部vant的组件。

  vant2: {
      pagePath: 'pages',
      // 可选,默认为 pages。如果页面目录不为pages,或有多个目录, 通过此值设置。
      // 参考配置:
      // pagePath: 'page2'                         page2为页面有目录
      // pagePath:['page1','page2',...]            多页面目录
         
      config: {
        inject: true,
        // 可选,默认为 true, 注入vant的全部组件。 如果不想全部, 通过此值设置。
        // 参考配置:
        // inject: false                           不注入任何组件 
        // inject:['button','icon',...]            只注入部分组件
                
        prefix: 'van-',
        // 可选,默认为 'van-', 组件名前缀。 如果使用其他组件名前缀, 通过此值设置。
        // 参考配置:
        // prefix: 'a-'                            button的组件名为'a-button'

        px2: false  
        // 可选,默认为false, 开启px单位转换。 可选值 true, false, config object {...}
       // 参考配置:
       // px2: true

      //  px2: {
      //       isVantOnly: false,      // 这个值是启用对于其他wxss的rpx处理
      //       relative: 400,          // 相对值,rpx是 相对于750宽度 ;  rem,em 是相对的 font-size
      //       decimalPlaces: 2,       // 保留的小数位数
      //       targetUnits: 'rpx'      // 目标转换的单位 支持 rpx rem em px
      //   }
      }
    }

页面注入配置

很多情况下,不希望注入太多的组件。可以通过全局配置的inject:falseinject:['button','icon',...]来实现。 但是某些特殊的页面又需要一些特殊的组件。可以通过下面的方式设置。

  1. 在页面的config中添加 vant2: ['button', 'card'],即可快速注入。该配置在当前页面,权重高于全局的inject设置
  config = {
    vant2: ['button', 'card']
  }