# vue-swipy

> Vue swipeable component

Latest version **0.1.1** (published 2020-12-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-swipy
pnpm add vue-swipy
yarn add vue-swipy
bun add vue-swipy
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2020-12-24 |
| First published | 2020-12-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Darko Macesic |
| Maintainers | dark64 |

## Links

- npm: https://www.npmjs.com/package/vue-swipy
- npm.io page: https://npm.io/package/vue-swipy

## Dependencies (1)

- [interactjs](https://npm.io/package/interactjs.md) ^1.10.1

## Recent versions

- 0.1.1 (latest) — 2020-12-24
- 0.1.0 — 2020-12-24

## README

# Vue-Swipy

Vue swipeable component for Tinder-like apps.

🚀 [See live demo](https://shard-labs.github.io/vue-swipy/)

## Installation

```bash
npm install vue-swipy
```

## Usage

```html
<template>
  <div id="app">
    <Swipeable
      v-for="card in cards"
      :key="card.id"
      v-on:swipe="onSwipe"
      :style="{
        position: 'absolute',
        height: '400px',
        width: '250px',
        background: card.color,
        borderRadius: '8px',
      }"
    />
  </div>
</template>

<script>
  import { Swipeable } from "vue-swipy";

  function getRandomColor() {
    var letters = "0123456789ABCDEF";
    var color = "#";
    for (var i = 0; i < 6; i++) {
      color += letters[Math.floor(Math.random() * 16)];
    }
    return color;
  }

  export default {
    name: "App",
    components: {
      Swipeable,
    },
    data() {
      return { cards: [] };
    },
    mounted() {
      this.cards.push({ id: Math.random(), color: getRandomColor() });
      this.cards.push({ id: Math.random(), color: getRandomColor() });
      this.cards.push({ id: Math.random(), color: getRandomColor() });
    },
    methods: {
      onSwipe(direction) {
        console.log(direction);
        setTimeout(() => {
          this.cards.pop();
          this.cards.unshift({ id: Math.random(), color: getRandomColor() });
        }, 300);
      },
    },
  };
</script>

<style>
  body {
    margin: 0;
  }
  #app {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
  }
</style>
```

---
_Source: https://npm.io/package/vue-swipy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
