vue3-input-filter
v0.0.3
Published
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
Downloads
173
Readme
Vue 3 + TypeScript + Vite
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 <script setup>
SFCs, check out the script setup docs to learn more.
Learn more about the recommended Project Setup and IDE Support in the Vue Docs TypeScript Guide.
安装
npm install vue3-input-filter
使用
//main.ts
import MyDirectivesPlugin from "vue3-input-filter";
const app = createApp(App);
app.use(MyDirectivesPlugin); // 注册插件
app.mount("#app");
示例
<input
type="text"
v-input-filter:telephone
v-model="count"
class="test"
placeholder="testInputFilter"
/>
配置
v-input-filter:[config]
config:
type: 'general' // 默认
| 'price' //价格-小数点后两位
| 'rate' //价格-小数点后4位
| 'integerLetter' //字母数字
| 'num' //数字
| 'positiveNum' //非0的数字
| 'telephone' ////手机号码,电话(可输入-,首位不能是0或-)