Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ctf0/vue-list-rendered

a custom directive to check if last item in list was rendered
https://github.com/ctf0/vue-list-rendered

Last synced: 26 days ago
JSON representation

a custom directive to check if last item in list was rendered

Awesome Lists containing this project

README

        


Vue List Rendered


npm npm

> to avoid performance drop we hook only into the [bind function](https://vuejs.org/v2/guide/custom-directive.html#Hook-Functions) 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

```bash
npm install vue-list-rendered --save
```

## Usage

- register the directive

```js
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.

```html



  • ...



export default {
data() {
return {
blogList: [...]
}
},
methods: {
doSomething(lastItem) {
console.log(lastItem)
}
}
}

```

### Security

If you discover any security-related issues, please email [[email protected]](mailto:[email protected]).