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

Height 0px and positions of all items aren't set. Nuxt 3, Vue 3 #142

Open
IDontLikeOpen opened this issue Apr 19, 2023 · 1 comment
Open

Comments

@IDontLikeOpen
Copy link

Here's my plugin

import { VueMasonryPlugin } from 'vue-masonry';

export default defineNuxtPlugin((context) => {
  context.vueApp.use(VueMasonryPlugin);
});

Component code

<template>
  <div class="contest-grid">
    <client-only>
      <div
        v-masonry
        transition-duration="0.3s"
        item-selector=".contest-grid__card-wrapper"
        column-width=".contest-grid__col"
        gutter=".contest-contest-grid__gutter"
        class="contest-grid__cards"
      >
        <div class="contest-grid__col"></div>
        <div class="contest-grid__gutter"></div>

        <div
          v-masonry-tile
          v-for="(item, index) in cards"
          :key="index"
          class="contest-grid__card-wrapper"
        >
          <div
            class="contest-grid__card"
          >
           {{ item.description }}
         </div>
        </div>
      </div>
    </client-only>
  </div>
</template>

<script>
const cards = [
 // some data
];

export default {
  name: 'ContestGrid',
  data() {
    return {
      cards,
    };
  },
};
</script>

<style lang="scss" scoped>
.contest-grid {
  &__cards {
    min-height: em(100);
    width: 100%;
  }

  &__col {
    width: 25%;
  }

  &__gutter {
    width: em(35);
  }

  &__card-wrapper {
    height: em(287);
    width: 25%;
  }

  &__card {
    width: 100%;
    height: 100%;
  }
}
</style>

as a result contest-grid__cards has height 0px and all the cards are stacked in one place

@TsingfunLee
Copy link

I encountered it, too.

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

2 participants