/* script */
import { createComponentName, componentMixin } from '../_utils/component';
const __vue_script__ = {
  name: createComponentName('portal'),
  mixins: [componentMixin],
  props: {
    // 挂载的节点 默认body
    target: {
      //eslint-disable-line
      default: 'body'
    },
    // 外层class
    name: {
      type: String,
      default: ''
    }
  },
  computed: {
    targetEl() {
      if (this.$isServer || !this.target) return;
      if (typeof this.target === 'string') return document.querySelector(this.target);
      return this.target;
    }

  },
  watch: {
    targetEl(el) {
      el.appendChild(this.$el);
    }

  },

  mounted() {
    if (this.targetEl) this.targetEl.appendChild(this.$el);
  },

  destroyed() {
    if (!this.levaeing || !this.name) {
      if (this.$el && this.$el.parentNode) this.$el.parentNode.removeChild(this.$el);
    }
  },

  render() {
    if (this.$slots.default) return this.$slots.default[0];
    return null;
  }

};
/* template */

/* style */

const __vue_inject_styles__ = undefined;
/* scoped */

const __vue_scope_id__ = undefined;
/* module identifier */

const __vue_module_identifier__ = undefined;
/* functional template */

const __vue_is_functional_template__ = undefined;
/* component normalizer */

import __vue_normalize__ from '../_utils/vue-normalize-component.js';
/* style inject */

/* style inject SSR */

export default __vue_normalize__({}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, undefined, undefined);