1

So far I have fetched a list of objects from my database (each contain a name and description) and would like to display these objects in a bootstrap grid so that each object has its own section with its name and description shown. So if for example there are 5 items in the list and I'd like 3 items per row, then it would look like this:

enter image description here

And the grid would be responsive to the screen size. I'm not very familiar with Vue and can't see how to do this without hardcoding the grid.

This is what my code currently looks like:

<template>
  <div class="app">
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: 'app2',
  data() {
    return {
      items: []
    }
  },
// Fetch items from database...
}
1
  • you can use boostrap-vue is too easy Commented May 28, 2020 at 19:00

1 Answer 1

1

Use v-for and bootstrap styles:

<template>
  <div class="app">

    <div class="row">
      <div class="col-sm" v-for="item in items">
        {{ item.prop1 }}
      </div>
    </div>

  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: 'app2',
  data() {
    return {
      items: []
    }
  },
// Fetch items from database...
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.