meta-ctrl-enter

Trigger Vue methods by pressing cmd+enter, windows+enter or ctrl+enter
8,491 4
Install
npm install meta-ctrl-enter
Latest Version:1.0.2
Vue:2
License:MIT
Last Updated:May 9, 2017
Links: GitHub  ·  npm
Maintainer: ecrmnn

meta-ctrl-enter

Trigger Vue methods by pressing cmd+enter, ctrl+enter or windows key+enter

npm version npm downloads npm license

Installation

npm install meta-ctrl-enter --save

Why?

Why not use @keydown.meta.enter="myMethod"?

Tl;dr: On Windows keyboards, meta is the windows key (⊞), and this is not a "natural" modifier key. By using v-meta-ctrl-enter you'll be able to use ctrl+enter which is a widley used modifier key.

From Vue.js documentation:

On Macintosh keyboards, meta is the command key (⌘). On Windows keyboards, meta is the windows key (⊞). On Sun Microsystems keyboards, meta is marked as a solid diamond (◆). On certain keyboards, specifically MIT and Lisp machine keyboards and successors, such as the Knight keyboard, space-cadet keyboard, meta is labeled “META”. On Symbolics keyboards, meta is labeled “META” or “Meta”.

Usage

// Load using CommonJS syntax
const Vue = require('vue');
const MetaCtrlEnter = require('meta-ctrl-enter');
Vue.use(MetaCtrlEnter);

// Load using ES6 syntax
import Vue from 'vue';
import MetaCtrlEnter from 'meta-ctrl-enter';
Vue.use(MetaCtrlEnter);
<template>
    <input type="text" v-meta-ctrl-enter="submit">
</template>

<script>
    export default {
      methods: {
        submit(event) {
          // This will be triggered when pressing;
          // cmd + enter
          // windows key + enter
          // ctrl + enter
          console.log('triggered ...', event);
        }
      }
    }
</script>

License

MIT © Daniel Eckermann

Related Packages

vue-currency-directive

Simple, quick custom directive for handling currency format inside text inputs.

2,646 6
@vueuse/head

Document head manager for Vue 3. SSR ready.

6,723,722 948
vue-page-title

Vue.js html/page title manager

103,341 130
ttfmeta

Node.js module and a library that extract metadata from ttf font file or buffer.

9,854 1
nuxt-meta-pixel

Nuxt best module to use Facebook's pixels in your application.

111,555 30

Version History

Version Released Vue License
1.0.2 ^2.3.2 MIT
1.0.1 ^2.3.2 MIT
1.0.0 ^2.3.2 MIT