<div id="app">
  <button @keyup.enter="enter" @keyup.tab="tab" @keyup.delete="delete1" @keyup.esc="esc" @keyup.space="space" @keyup.up="up" @keyup.down="down" @keyup.left="left" @keyup.right="right">{{ message }}</button>
  <p>{{ message }}</p>
</div>
@import url(https://fonts.googleapis.com/css?family=Montserrat);

html,body {
  width: 100vw;
  height: 100vh;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: montserrat;
  background: 
		linear-gradient(rgba(196, 102, 0, 0.6), rgba(155, 89, 182, 0.6));
}

#app {
  background: white;
	border: 0 none;
	border-radius: 3px;
	box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4);
	padding: 20px 30px;
	box-sizing: border-box;
  text-align: center;
}

button {
  padding:15px 60px;
  outline: none;
  background-color: #27ae60;
  border: none;
  border-radius:5px;
  box-shadow: 0 9px #95a5a6;
  display: block;
  margin-bottom: 30px;
  font-size: 1rem;
  color: #fff;
  width: 100%;

  &:hover{
    background-color: #2ecc71;
  }

  &:active {
    background-color: #2ecc71;
    box-shadow: 0 5px #95a5a6;
    transform: translateY(4px);
  }
}
p {
  text-align: center;
}
View Compiled
let app = new Vue({
  el: '#app',
  data () {
    return {
      message: '将光标置于按钮上后,按下键盘上不同的按键,会有不同的效果'
    }
  },
  methods: {
    enter: function (){
      this.message = '你按了回车键:enter'
    },
    tab: function (){
      this.message = '你按了tab键: tab'
    },
    delete1: function (){
      this.message = '你按了删除键: delete'
    }, 
    esc: function (){
      this.message = '你按了取消键: esc'
    },
    space: function (){
      this.message = '你按了空格键:space'
    },
    up: function (){
      this.message = '你按了向上键:up'
    },
    down: function (){
      this.message = '你按了向下键:down'
    },
    left: function (){
      this.message = '你按了向左键:left'
    },
    right: function (){
      this.message = '你按了向右键:right'
    }
  }
})
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/vue/2.3.4/vue.min.js