<template>
  <div class="s-popup" @click="stop">
    <slot></slot>
  </div>
</template>

<script>
// @ is an alias to /src

export default {
  name: 's-popup',
  props: {},
  data() {
    return {};
  },
  mounted() {
    document.addEventListener('click', this.close.bind(this));
  },
  watch: {},
  computed: {},
  methods: {
    stop(event) {
      event.stopPropagation();
    },
    close(event) {
      this.$emit('close', event);
    },
  },
  beforeDestroy() {
    document.removeEventListener('click', this.close.bind(this));
  },
};
</script>
