vue-animated-list

A Vue.js plugin for easily animating `v-for` rendered lists.

  • 所有者: vuejs/vue-animated-list
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

vue-animated-list

NOTE: this plugin is for Vue 1.x only. Vue 2.0 supports moving animations out of the box.

A Vue.js plugin for easily animating v-for rendered lists.

Live Demo

Compatibility: IE10+.

Installation

  • With Modules

    // ES6
    import Vue from 'vue'
    import VueAnimatedList from 'vue-animated-list'
    Vue.use(VueAnimatedList)
    
    // ES5
    var Vue = require('vue')
    Vue.use(require('vue-animated-list'))
    
  • <script> Include

    Just include vue-animated-list.js after Vue itself.

Usage

There's nothing you need to do in JavaScript except for installation. In your markup, make sure the v-for has a transition attribute:

<div v-for="item in items" transition="item">
  {{ item.text }}
</div>

Now, all you need to do is define the .item-move CSS class:

.item-move {
  /* applied to the element when moving */
  transition: transform .5s cubic-bezier(.55,0,.1,1);
}

And that's it! You can also add CSS classes for enter and leave transitions - they all work nicely together!

A few things to note:

  1. The animation is done using the CSS transform property. So make sure when .item-move is applied its transform property is transition-enabled.

  2. Move animations can only work on elements, so it doesn't work for <template v-for> and fragment instance components.

How Does It Work?

This is inspired by this great post by Joshua Comeau, which is in turn based on the FLIP technique by Paul Lewis. So read those if you are interested in the technical details!

License

MIT

主要指标

概览
名称与所有者vuejs/vue-animated-list
主编程语言JavaScript
编程语言HTML (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2016-02-18 15:50:52
推送于2016-09-29 00:09:18
最后一次提交2016-09-28 20:09:18
发布数3
最新版本名称v1.0.2 (发布于 2016-02-18 11:22:05)
第一版名称v1.0.0 (发布于 )
用户参与
星数461
关注者数10
派生数47
提交数16
已启用问题?
问题数7
打开的问题数5
拉请求数2
打开的拉请求数0
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?