Giter Club home page Giter Club logo

my-directive's Introduction

Vue 自定义指令库

这是一个使用 webpack 打包的 Vue 自定义指令库。

目的:让前端开发更高效,更专注于业务代码的编写

业务开发过程中,会经常用到按钮权限控制清空两端空格限制数字输入等常用方法,为避免不同项目多次复制粘贴的麻烦,这里统一封装,以提高开发效率。

使用方式

  1. 使用 npm 安装:
npm install tyro-directive --save
  1. 注册指令:
import Vue from 'vue';
import TyroDirective from "tyro-directive";

Vue.use(TyroDirective);

发布到 npm

npm run build // 先webpack打包类库,之后再发布
npm login // 登录
npm publish // 发布

介绍文档

基于 vue 的自定义指令集合,包含

  • 按钮权限控制 v-permission
  • 清空两端空格 v-trim
  • 限制只能输入数字 v-input-number

v-permission

使用:给按钮加上 v-permission 及权限 code 。(需要配合路由使用 route.meta.btnPermission)

<template>
  <el-button v-permission="'BUTTON_ADD'">新增</el-button>
</template>

v-trim

使用:给输入框加上 v-trim 。

<template>
  <el-input v-trim v-model="value" />
</template>

v-input-number

使用:给输入框加上 v-input-number 。

<template>
  <el-input v-input-number v-model="value" />
</template>

my-directive's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.