Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gauseen/keyboard-for-vue

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gauseen/keyboard-for-vue

virtual keyboard for vue

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

virtual keyboard for vue

预览

Demo Live

特性

  • 轻量、无其他依赖
  • 支持电脑原生键盘和 virtual keyboard 同时使用
  • 自定义布局、样式

使用

# 安装
yarn add @gauseen/keyboard-for-vue
# OR
npm i -S @gauseen/keyboard-for-vue
ESM 引入
// main.js
import Vue from 'vue'
import KeyboardForVue from '@gauseen/keyboard-for-vue'

Vue.use(KeyboardForVue)
浏览器脚本引入
<link rel="stylesheet" href="https://unpkg.com/@gauseen/keyboard-for-vue/dist/keyboardForVue.css">

<script src="https://unpkg.com/@gauseen/keyboard-for-vue"></script>
Demo
<template>
  <div class="demo">
    <form>
      <fieldset>
        <legend>keyboard for vue:</legend>
        Name: <input v-model="name" @focus="onFocus" autofocus type="text">
        <p>{{name}}</p>

        Email: <input v-model="email" @focus="onFocus" type="text"><br>
        <p>{{email}}</p>

        Money: <input v-model="money" @focus="onFocus" type="text"><br>
        <p>{{money}}</p>

        <div>
          Switch style:
          <input type="radio" id="normal" value="normal" v-model="keyboardStyle">
          <label for="normal">normal</label>
          <input type="radio" id="number" value="number" v-model="keyboardStyle">
          <label for="number">number</label> &nbsp;
          <button @click.prevent="handleClear"> Clear </button>
        </div>
      </fieldset>
    </form>
    <keyboard-for-vue
      :input="input"
      :is-show.sync="isShow"
      :keyboard-style="keyboardStyle"
      @on-close="handleClosed"
    >
    </keyboard-for-vue>
  </div>
</template>
<script>
export default {
  name: 'Demo',
  data () {
    return {
      keyboardStyle: 'normal',
      isShow: false,
      input: null,
      name: 'gauseen',
      email: '',
      money: ''
    }
  },
  methods: {
    onFocus (e) {
      this.input = e.target
      this.isShow = true
    },
    handleClear (e) {
      this.name = ''
      this.email = ''
      this.money = ''
      this.isShow = false
    },
    handleClosed (value) {
      window.alert(value)
    }
  }
}
</script>

属性

属性类型说明默认参数可选值必填?
inputHTMLInputElement键盘将要输入的 input DOM 对象-input DOM
is-show.syncBoolean虚拟键盘是否显示falsetrue、false
keyboard-styleString虚拟键盘是否显示normalnormal、number
font-colorString键盘字体颜色#fff-
line-style-heightString每个键的高度60px-
key-style-bg-colorString每个键背景色#5b6878-

方法

方法说明回调参数
on-close键盘消失时回调function(inputValue)

Keywords

FAQs

Package last updated on 03 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc