Coder Social home page Coder Social logo

mp-swipe-card's Introduction

小程序卡片滑动组件

小程序的滑动片组件,类似探探的,支持无限滑动,可动态向卡片组中push新内容。

用法

git clone https://github.com/qizf7/mp-swipe-card.git

引入mp-swipe-card组件,mp-swipe-card组件依赖mp-swipe-card-item组件,定制卡片内容可以在此组件中编写,详见index页面。

由于无法使用scoped slot,目前使用一个单独的组件来定义卡片中的内容。在此项目中为mp-swipe-card-item组件,可修改为其他组件。

效果演示

属性

push-list(Array)

推入组件的数组。每次变化都会将新的数组推入组件中,抽象组件内(mp-swipe-card-item)可以接收推入的数组项,自定义卡片内容。

push-update(Object)

用来更新list内的数据。对象格式如下

{
  index: 0, // 要更新的item索引
  data: {
    name: '小小宝'  // 要更新的item数据,更新使用Object.assign将data合并到原数据。
  }
}

disabled(Boolean)

是否禁止滑动

事件

swipeout

卡片滑出时触发

// eventDetail
{
  direction: 'right',   // 方向,left左,right右
  item, // 被滑走的条目
  list, // 完整的数组
}

swipereset

滑动卡片重置位置时触发

// eventDetail
{
  item, // 被滑走的条目
  list, // 完整的数组
}

todo list

  • 优化动画效果,新增多方向滑动

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.