日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 前端技术 > vue >内容正文

vue

cleave.js_Cleave.js的Vue.js 2.x组件

發(fā)布時(shí)間:2024/3/24 vue 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 cleave.js_Cleave.js的Vue.js 2.x组件 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

cleave.js

切裂分量 (vue-cleave-component)

Vue.js component for cleave.js

對(duì)于Vue.js組件cleave.js

View demo 查看演示 Download Source 下載源

特征 (Features)

  • Reactive v-model value

    React性v-model值

    • You can change input value programmatically

      您可以通過編程方式更改輸入值
  • Reactive options

    React選項(xiàng)

    • You can change config options dynamically

      您可以動(dòng)態(tài)更改配置選項(xiàng)
    • Component will watch for any changes and redraw itself

      組件將監(jiān)視任何更改并重新繪制自身
    • You are suggested to modify config via Vue.set

      建議您通過Vue.set修改配置
  • Compatible with Bootstrap, Bulma or any other CSS framework

    與Bootstrap,Bulma或任何其他CSS框架兼容

  • Option to disable raw mode to get masked value

    禁用raw模式以獲取掩碼值的選項(xiàng)

安裝 (Installation)

# npm npm install vue-cleave-component --save# Yarn yarn add vue-cleave-component

用法 (Usage)

<template><div><cleave v-model="cardNumber" :options="options" class="form-control" name="card"></cleave></div> </template><script>import Cleave from 'vue-cleave-component';export default { data () {return {cardNumber: null, options: {creditCard: true,delimiter: '-',} }},components: {Cleave}} </script>

作為插件 (As plugin)

import Vue from 'vue';import Cleave from 'vue-cleave-component';Vue.use(Cleave);

This will register a global component <cleave>

這將注冊(cè)一個(gè)全局組件<cleave>

可用道具 (Available props)

The component accepts these props:

該組件接受以下道具:

AttributeTypeDefaultDescription
v-model / valueString / Number / nullnullSet or Get input value (required)
optionsObject{}Cleave.js options
rawBooleantrueWhen set to false; emits formatted value with format pattern and delimiter
typeStringtextSet input type; for eg: tel
屬性 類型 默認(rèn) 描述
v模型/值 字符串/數(shù)字/空 null 設(shè)置或獲取輸入值(必填)
選項(xiàng) 目的 {} Cleave.js 選項(xiàng)
生的 布爾型 true 設(shè)為false ; 發(fā)出帶有格式模式和定界符的格式化值
類型 text 設(shè)置輸入類型; 例如: tel

在非模塊環(huán)境中安裝(沒有webpack) (Install in non-module environments (without webpack))

  • Include required files

    包括所需文件

<!-- cleave.js --> <script src="https://unpkg.com/[email?protected]/dist/cleave.min.js"></script> <!-- Vue.js --> <script src="https://unpkg.com/[email?protected]/dist/vue.min.js"></script> <!-- Lastly add this package --> <script src="https://unpkg.com/vue-cleave-component"></script>
  • Use the component anywhere in your app like this

    像這樣在應(yīng)用程序中的任何地方使用組件

<main id="app"> <cleave v-model="card" :options="options"></cleave> </main> <script>// Initialize global componentVue.use(VueCleave);new Vue({el: '#app',data: {card: null,options: {creditCard: true,}}, }); </script>

在本地主機(jī)上運(yùn)行示例 (Run examples on your localhost)

  • Clone this repo

    克隆此倉庫

  • You should have node-js >=6.10 and yarn >=1.x pre-installed

    您應(yīng)該預(yù)先安裝node-js> = 6.10和yarn> = 1.x

  • Install dependencies yarn install

    安裝依賴項(xiàng)yarn install

  • Run webpack dev server yarn start

    運(yùn)行webpack dev服務(wù)器yarn start

  • This should open the demo page at http://localhost:9000 in your default web browser

    這應(yīng)該在默認(rèn)的Web瀏覽器中打開位于http://localhost:9000的演示頁面。

翻譯自: https://vuejsexamples.com/vue-js-2-x-component-for-cleave-js/

cleave.js

總結(jié)

以上是生活随笔為你收集整理的cleave.js_Cleave.js的Vue.js 2.x组件的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。