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-autonumeric-directive

v1.1.4

Published

Vue directive plugin to assure number to be number

Downloads

7

Readme

vue-autonumeric-directive

npm Version

Node.js

GitHub License

Build Status

example

Introduction

vue-autonumeric-directive是一个基于autoNumeric的Vue插件,使用简单的指令方式,对需要的元素添加格式化功能。

Use Guide

Installation

# with `yarn` :
yarn add vue-autonumeric-directive
# or with `npm` :
npm install vue-autonumeric-directive --save

How to use?

按照Vue插件方式注册插件。

在浏览器中插件的全局名称为VueNumberFormat

<input name="input1" id="input1" v-model="input1" v-number="config1">
new Vue({
  el: '#demo',

  data: {
    input1: '123.00',
    config1: { bind: 'input1' },
    input2: 32,
  }
})

On which elements can it be used

On which elements can it be used

<input>

只支持下列input类型

  • text,
  • tel,
  • hidden, or
  • no type specified at all

支持contenteditable元素

支持其他元素的一次性格式化

支持Vue组件

支持element-ui Input组件

Options

全局Options

export type PluginsOptions = {
  unsafeSet: boolean; // use unsafe method to set value to element and vnode (eval, more powerful)

  pure: boolean;	// 是否不使用分隔符(例如千分位逗号)
  presion: number;	  // 精确到小数点后几位
}

指令Options

declare type InputOptions = {
  unsafeSet: boolean;

  bind: string;
  min: string,
  max: string,
  presion: string,  // 精确到小数点后几位

  local: string,    // autoNumeric本地化配置,
  predifined: string, // autoNumeric预定义配置

  numricOptions: AutoNumericOptions;
};

指令modifiers

  • int // 整数
  • pure // 不使用分隔符(例如千分位逗号)
  • ppi // pure positive integer 无分隔符正整数

numricOptions选项

参考numberic numricOptions autoNumeric options

Features

  1. 保留原事件响应
  2. 把AutoNumeric挂在了插件下
  3. 把AutoNumeric的实例挂在了对应的element下,方便调用它的方法