Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign in
Socket

vue-list-rendered

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-list-rendered

a vue v2 directive to check if last item in list was rendered

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Vue List Rendered

npm npm

to avoid performance drop we hook only into the bind function which is called only once,
also to make sure the directive doesnt add any extra load we check by index & at the end we send the last item value.

Installation

npm install vue-list-rendered --save

Usage

  • register the directive

    window.Vue = require('vue')
    require('vue-list-rendered')
    
    new Vue({
        el: '#app',
    })
    
  • add v-list-rendered="[index, list, callback]" to your v-for element

    • to debug the results add :debug argument ex.v-list-rendered:debug="..." then check your console.
    <template>
        <ul>
            <li v-for="(blog, index) in blogList" :key="blog"
                v-list-rendered="[index, blogList, doSomething]">
                ...
            </li>
        </ul>
    </template>
    
    <script>
        export default {
            data() {
                return {
                    blogList: [...]
                }
            },
            methods: {
                doSomething(lastItem) {
                    console.log(lastItem)
                }
            }
        }
    </script>
    

Keywords

vue

FAQs

Package last updated on 23 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts