V
V
Vlad Sklyarenko2018-09-10 23:31:58
Vue.js
Vlad Sklyarenko, 2018-09-10 23:31:58

Why can't Vue.js v-for list output?

Tell me what's wrong. I've been fighting for an hour now. Does not display a list, for the life of me.

<template>
    <ul id="example-1">
        <li v-for="todo in items">
            {{ todo }}
        </li>
    </ul>
</template>
<script>
    export default {
        data:{
            items: ['iPhone 7', 'Galaxy S8', 'Nokia N8', 'Xiaomi Mi6']
        },
    }
</script>
<style>
</style>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-09-10
@NauGaika

Считаете чтение документации излишним? Очень зря. Ведь иначе вы бы знали, что data должна быть функцией:

data() {
  return {
    items: ['iPhone 7', 'Galaxy S8', 'Nokia N8', 'Xiaomi Mi6'],
  };
},

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question