V
V
Vanya Huk2017-07-04 17:47:37
Vue.js
Vanya Huk, 2017-07-04 17:47:37

Why is v-for not seeing the variable?

when I output it in curly brackets, then everything is fine, but when I give it v-for, it doesn’t see it ( last_page is
an int number
)

<template>
    <div v-if="this.$parent.pages.last_page > 1" class="col-xs-12 text-center">

        <ul class="list-unstyled pagination">

            <li  v-if="this.$parent.pages.last_page < ( this.$parent.pages.step * 2 + 6 )" class="page__item" onclick="filter.get_products(this)" >

             </li>

            {{this.$parent.pages.last_page}}
        </ul>
    </div>
</template>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2017-07-04
@vanyahuk

you don't need to use this in templates, and using $parent to access the parent component is not very good. Try to bind components via props, or use shared storage or vuex

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question