Skip to content

Instantly share code, notes, and snippets.

@Kelin2025
Last active May 8, 2022 04:06
Show Gist options
  • Save Kelin2025/90ad18df3a69300eb93fa7ce9624a8d1 to your computer and use it in GitHub Desktop.
Save Kelin2025/90ad18df3a69300eb93fa7ce9624a8d1 to your computer and use it in GitHub Desktop.
<template>
<Responsive :breakpoints="{
small: el => el.width <= 500
}">
<div slot-scope="el" :class="['post__item', { small: el.is.small }]">
<img class="post__image" :src="post.image" />
<div class="post__text">{{post.text}}</div>
</div>
</Responsive>
</template>
<script>
import { Responsive } from "vue-responsive-components"
export default {
props: ['post'],
components: { Responsive }
}
</script>
<style lang="scss">
.post__item {
display: flex;
}
.post__image {
flex: 0 0 200px;
height: 200px;
}
.post__item.small {
flex-direction: column;
.post__image {
flex: 0 auto;
height: auto;
}
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment