vc-directive
v0.1.4-Beta
Published
A Vue custom directive library
Downloads
3
Maintainers
Readme
使用
- 安装
npm install vc-directive
or
yarn add vc-directive
- 全局注册
// main.js
import Vue from 'vue'
import VcDirectives from 'vc-directive'
Vue.use(VcDirectives)
...
然后在任一的vue组件中即可使用需要的指令,例如:
<div v-vcfocus></div>
- 按需注册
<template>
<div>
<input v-focus v-model="text" />
</div>
</template>
import { vcFocus } from 'vc-directive'
export default {
directives: {
vfocus: vcFocus
},
data() {
return {
text: 'hello vc-directive'
}
}
}
License
MIT License © 2022-PRESENT Panjinhong