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

vue-directive-bb

v2.1.4

Published

vue 后台常用指令

Downloads

2

Readme

vue-directive-bb

vue后台常用指令,其实自定义指令非常简单,这其实就是js原生; 当你走过一条陌生的路后,再走一遍,内心由惊恐害怕变成欢喜激动。 万事懂原理,框架的实现过程是把简单的复杂化,框架的理解过程是把复杂的简单化。

vue input 数字指令

  • v-input-number 整数
  • v-input-number.float 浮点数
  • v-input-number.float="2" 保留2位浮点数
<el-input v-input-number.float size="mini" v-model="location.kilometre"></el-input>

bug

  • 饿了么表单校验存在问题
  • 解决方案
// 计算属性
price: [
         {
           required: true,
           message: '请填写商品价格',
           validator: this.validatePrice,
           trigger: 'blur'
         }
       ]
  
// 校验函数
validatePrice(rule, value, callback) {
     if (typeof value === 'number') {
       callback();
     } else {
       value = value.replace(/[a-zA-Z]/g, '');
       this.productForm.price = value; // 重点
     }
     if (!value) {
       callback(new Error('商品价格'));
     } else {
       callback();
     }
   },

vue 时间戳格式化 (ant design数据格式规范)

| 时间 | 展示形式| |----|----| |1 分钟以内的时间|刚刚| |1 小时以内的时间| N 分钟前| |24 小时以内的时间| N 小时前| |24 小时以外的时间| 用 mm-dd HH:mm 的形式表示,即 12-08 08:00| |超过一年的时间 |用 yyyy-mm-dd HH:mm 的形式表示,即 2019-12-08 08:00|

<div class="time tr vc fs12" v-time="1615259980998"></div> 渲染成 -> 03-09 11:20

vue 缩略隐藏鼠标悬浮提示

1、跟目录新增节点

 <div class="custome-popover" style="position: absolute;display: none; padding: 4px;line-height:20px;font-size: 12px;border: 1px solid #999;background: #fff; z-index:9999;"></div>

2、全局范围新增样式

.toel{
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

3、使用

<div :title="'超长内容超长内容超长内容'" v-omit-popover class="toel">{{超长内容超长内容超长内容}}</div>