vue-touch-keyboard 68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f7675652d746f7563682d6b6579626f6172642e73766768747470733a2f2f696d672e736869656c64732e696f2f62616467652f767565253230322e782d636f6d70617469626c652d677265656e2e737667

Virtual keyboard component for Vue.js v2.x. Designed to Raspberry Pi Touch Display

68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f356633353934623330646434343839303934373330666132626162643762613568747470733a2f2f7472617669732d63692e6f72672f696365626f622f7675652d746f7563682d6b6579626f6172642e7376673f6272616e63683d6d617374657268747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f696365626f622f7675652d746f7563682d6b6579626f6172642f62616467652e7376673f6272616e63683d6d617374657268747470733a2f2f6261646765732e6e706d732e696f2f7675652d746f7563682d6b6579626f6172642e737667

68747470733a2f2f64617669642d646d2e6f72672f696365626f622f7675652d746f7563682d6b6579626f6172642e73766768747470733a2f2f64617669642d646d2e6f72672f696365626f622f7675652d746f7563682d6b6579626f6172642f6465762d7374617475732e73766768747470733a2f2f696d672e736869656c64732e696f2f6e706d2f64742f7675652d746f7563682d6b6579626f6172642e737667

If you like my work, please donate. Thank you!

Demo

b30e7f656ab7e4e942a865b647e073cd.png

Features

3 built-in layouts, but you can create custom layouts

no external dependencies

full responsive

customizable styles

...etc

Installation

NPM

You can install it via NPM.

$ npm install vue-touch-keyboard

Manual

Download zip package and unpack and add the vue-touch-keyboard.css and vue-touch-keyboard.js file to your project from dist folder.

https://github.com/icebob/vue-touch-keyboard/archive/master.zip

Usage

import VueTouchKeyboard from "vue-touch-keyboard";

import style from "vue-touch-keyboard/dist/vue-touch-keyboard.css"; // load default style

Vue.use(VueTouchKeyboard);

export default {

data: {

visible: false,

layout: "normal",

input: null,

options: {

useKbEvents: false,

preventClickEvent: false

}

},

methods: {

accept(text) {

alert("Input text: " + text);

this.hide();

},

show(e) {

this.input = e.target;

this.layout = e.target.dataset.layout;

if (!this.visible)

this.visible = true

},

hide() {

this.visible = false;

}

}

}

Properties

Property

Default

Accepted values

Description

input

required

HTMLInputElement

The target input HTML element

layout

required

String or Object

Layout of keys. If you are using the built-in layouts, you can set as the name of the layout. If you want to use custom layout, you need to set a layout Object.

accept

null

Function

Event handler. Fired when the "Accept/Close" button pressed.

cancel

null

Function

Event handler. Fired when the "Cancel" button pressed.

change

null

Function

Event handler. Fired when the input value changed.

next

null

Function

Event handler. Fired when the "Next" button pressed or the length of the value of the input reached the maxLength of the input

options

{}

Object

Functional options.

defaultKeySet

default

String

Default key set. You can choose a desired key set of your layout to be used when a keyboard is initialized.

Options

Option

Default

Accepted values

Description

useKbEvents

false

boolean

If true, the component will generate a keydown event and trigger it. If it returns with false, it won't insert the new character.

preventClickEvent

false

boolean

If true, the component will preventDefault the click event.

Built-in layouts

normal - Normal full layout. Similar as real keyboard layouts

numeric - Only for numbers

compact - Compact layout. Similar as mobile phone keyboard layouts

Development

This command will start a webpack-dev-server with content of dev folder.

npm run dev

Build

This command will build a distributable version in the dist directory.

npm run build

Test

npm test

Contribution

Please send pull requests improving the usage and fixing bugs, improving documentation and providing better examples, or providing some testing, because these things are important.

License

vue-touch-keyboard is available under the MIT license.

Contact

Copyright (C) 2016 Icebob

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6769746875622d696365626f622d677265656e2e73766768747470733a2f2f696d672e736869656c64732e696f2f62616467652f747769747465722d496365626f626373692d626c75652e737667

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐