vue-mobile-virtual-keyboard
Advanced tools
Comparing version
{ | ||
"name": "vue-mobile-virtual-keyboard", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "A keyboard component in vue.", | ||
@@ -5,0 +5,0 @@ "author": "Henrie's Mac <zenoduaciosiua@hotmail.com>", |
@@ -1,5 +0,7 @@ | ||
# vue-mobile-virtual-keyboard 1.0.1 | ||
# vue-mobile-virtual-keyboard 1.1.0 | ||
受夠了需求老是要求【只能輸入純數字】【只能輸入身份證】的要求了 | ||
受夠了已經給設置自動展開數字鍵盤了,還硬是要自己點成英文輸入法,然後跟妳講【這裡不應該可以輸入英文】的xx測試 | ||
受夠了動不動就正則替換的人了 | ||
@@ -9,5 +11,8 @@ | ||
我要有一個自定義的鍵盤! | ||
我要有一個鍵盤: | ||
支持插件形式調用 | ||
- 支持插件形式調用; | ||
- 默認帶【身份證】【數字】【金額】鍵盤; | ||
- 隨便自定義鍵盤佈局; | ||
- ui要改主題,無所畏懼; | ||
@@ -31,5 +36,5 @@ ## 長這樣 | ||
import Vue from 'vue'; | ||
import { KeyboardComponent } from 'vue-mobile-virtual-keyboard'; | ||
import { KeyboardPlugin } from 'vue-mobile-virtual-keyboard'; | ||
Vue.component(KeyboardComponent); | ||
Vue.use(KeyboardPlugin); | ||
``` | ||
@@ -55,3 +60,3 @@ | ||
下例為精簡demo,如果一個頁面中存在兩個不同佈局的鍵盤,可詳細參看完整demo:`src/demos/index.vue` | ||
下例為精簡demo,可詳細參看完整demo:`src/demos/index.vue` 或 `src/pages/index.vue` | ||
@@ -75,3 +80,3 @@ ### 插件使用 | ||
this.$keyboard.update({ | ||
propKeyList: lowerKeyList | ||
type: lowerKeyList | ||
}); | ||
@@ -121,18 +126,20 @@ ``` | ||
- propKey-list [Array]:鍵盤keymap,默認為九宮數字鍵盤 | ||
- type [String, Array]:鍵盤keymap,默認為九宮數字鍵盤 | ||
數組中按鈕接收三種格式:String,Number,Object | ||
1. 支持內置類型 `number`,`chinaCardId`,`digit` | ||
[String,Number]:每一行的按鍵大小為 `(100 / 當行按鍵數)%` | ||
2. 也支持傳佈局數組,數組中按鈕接收三種格式:String,Number,Object | ||
[Object]:必須定義 `code` 和 `span` 屬性,`alias` 選填 | ||
[String,Number]:每一行的按鍵大小為 `(100 / 當行按鍵數)%` | ||
```javascript | ||
{ | ||
code: 'space', // 按鍵顯示名 | ||
span: '5/8', // 佔用寬度,分子/分母 | ||
alias: ' ' // 別名,即實際輸出。若不定義,則取code | ||
} | ||
``` | ||
[Object]:必須定義 `code` 和 `span` 屬性,`alias` 選填 | ||
```javascript | ||
{ | ||
code: 'space', // 按鍵顯示名 | ||
span: '5/8', // 佔用寬度,分子/分母 | ||
alias: ' ' // 別名,即實際輸出。若不定義,則取code | ||
} | ||
``` | ||
- delete-key [String]:指定刪除鍵 | ||
@@ -142,2 +149,6 @@ | ||
- title [String]:鍵盤標題 | ||
- prefix-cls [String]:樣式前綴,以重寫樣式 | ||
### 事件 | ||
@@ -150,7 +161,10 @@ | ||
2019.06.04.002 | ||
2019.06.05 - 1.1.0 | ||
- 發佈npm包; | ||
- 增加 `type` 屬性,接收內置鍵盤類型 `number`、`chinaCardId`、`digit` 或數組; | ||
- `propKeyList` 屬性變更為 `type` 屬性; | ||
- 支持鍵盤樣式自定義; | ||
- 支持鍵盤加標題; | ||
2019.06.04.001 | ||
2019.06.04.001 - 1.0.1 | ||
@@ -165,3 +179,4 @@ - 增加plugin註冊方式; | ||
- [x] plugin使用 | ||
- [ ] 加幾個默認鍵盤 | ||
- [x] 加幾個默認鍵盤 | ||
- [ ] 允許擴展 `keymap` | ||
@@ -168,0 +183,0 @@ ## 聯繫與討論 |
@@ -6,2 +6,4 @@ import Vue from 'vue'; | ||
import App from './App'; | ||
// npm安裝引用 | ||
// import { KeyboardPlugin } from 'vue-mobile-virtual-keyboard'; | ||
import KeyboardPlugin from './plugin/keyboard'; | ||
@@ -8,0 +10,0 @@ |
@@ -45,2 +45,7 @@ import KeyboardComponent from '../../components/keyboard.vue'; | ||
} | ||
const defaults = {}, | ||
props = $vm.$options.props; | ||
for (let i in props) { | ||
defaults[i] = props[i].default; | ||
} | ||
const keyboard = { | ||
@@ -52,5 +57,3 @@ show (options = {}) { | ||
}); | ||
if (!options.propKeyList) { | ||
options.propKeyList = []; | ||
} | ||
util.deepClone($vm, defaults); | ||
util.deepClone($vm, options); | ||
@@ -57,0 +60,0 @@ $vm.show = true; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
95852
26.79%20
5.26%222
9.36%186
8.77%