/v-outside

good click outside solution based on vue directives,很棒的基于 vue 指令的 click outside 解决方案。

Primary LanguageJavaScript

vue-focus-outside

使用

<template>
  <div id="app">
    <button v-focus-outside="focusOustsideHandler">点我啊</button>
    <iframe width="100%" height="300"></iframe>
  </div>
</template>
<script>
import Vue from 'vue'
import focusOutside from 'vue-focus-outside'

new Vue({
  el: '#app',
  directives: {
    focusOutside
  },
  methods: {
    focusOustsideHandler () {
      console.log('点击到按钮外面了。')
    }
  }
})
</script>