Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue 2.1.0/2.1.2/2.1.3 removing display: block from root div #4306

Closed
ansarizafar opened this issue Nov 24, 2016 · 0 comments
Closed

Vue 2.1.0/2.1.2/2.1.3 removing display: block from root div #4306

ansarizafar opened this issue Nov 24, 2016 · 0 comments

Comments

@ansarizafar
Copy link

ansarizafar commented Nov 24, 2016

I have found out that Vue 2.1.0/2.1.2/2.1.3 is removing display: block from root div in single page component. The following code was working with ver 2 but ver 2.1+ are removing display:block from root div automatically.

<template>
<transition name="fade">
  <div class="ui dimmer modals page" v-if="showBackDrop" style="display: block !important; overflow-y: scroll;" :style="{ visibility: showBackDrop ? 'visible' : 'hidden', opacity: showBackDrop ? '1' : '0'}" @click="closeModal()">
    <transition name="scale">
      <div :id="id" class="ui modal active visibility" v-show="showModal" :class="[size, type, isScroll ? 'scrolling' : ''] " @click="clickContent($event)">
        <slot></slot>
      </div>
    </transition>
  </div>
</transition>
</template>

<script>
export default {
name: 'modal',
  props: {
    size: {
      type: String,
      default: 'small'
    },
    type: {
      type: String,
      default: ''
    },
    closeable: {
      type: Boolean,
      default: true
    },
    isScroll: {
      type: Boolean,
      default: false
    }

      },

  data() {
    return {
      id: `modal_${Math.random()}`,
      showBackDrop: false,
      showModal: false
        }
  },

  mounted() {
    document.body.classList.add("dimmable");

  },

  methods: {
    clickContent(event) {
      event.stopPropagation();
    },
    open() {
      this.showBackDrop = true
      document.body.classList.add("dimmed");
      setTimeout(() => {
        this.showModal = true;
        setTimeout(() => {
          this.$el.firstChild.style.top = ((document.body.offsetHeight - this.$el.firstChild.offsetHeight) / 2) + 'px';
        })
      });

    },
    close() {
      this.showModal = false
      setTimeout(() => {
        this.showBackDrop = false
        document.body.classList.remove("dimmed");
      }, 30);
    },
    closeModal() {
      if (!this.closeable) {
        return;
      }
      this.close();
    }

  }
}
</script>


<style>


.modal .header {background: #f0f8ff !important;}

.scale-enter-active {
  animation: scaleIn .5s;
}

.scale-leave-active {
  animation: scaleOut .5s;
}

.fade-enter-active {
  animation: fadeIn .5s;
}

.fade-leave-active {
  animation: fadeOut .5s;
}
</style>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant