New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

vue-composable

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-composable

vue-composable

1.0.0-dev.4
Version published
Weekly downloads
4K
20.25%
Maintainers
1
Weekly downloads
 
Created

vue-composable

CircleCI Coverage Status npm version

vue-next

For vue-next support please check @next

Introduction

vue-composable is out-of-box ready to use composition-api generic components, eg: useFetch

100% typescript based composable components and full type support out-of-box.

Installing

# install with yarn
yarn add @vue/composition-api vue-composable

# install with npm
npm install @vue/composition-api vue-composable

Documentation

Check our documentation

Event

  • Event - Attach event listener to a DOM element
  • Mouse Move - Attach mousemove listener to a DOM element
  • Resize - Attach resize listener to a DOM element
  • Scroll - Attach scroll listener to a DOM element

MISC

Pagination

Promise

Web

External

New packages needed

Examples

Check out the examples folder or start hacking on codesandbox.

Edit Vue Composable Examples

NOTE

Currently only works with composition-api, when Vue3 gets release I will update to use the new reactive system (using @vue/reactivity)

For vue-next support please check @next

Usage

<template>
  <div>
    <p>page {{ currentPage }} of {{ lastPage }}</p>
    <p>
      <button @click="prev">prev</button>
      <button @click="next">next</button>
    </p>
    <ul>
      <li v-for="n in result" :key="n">
        {{ n }}
      </li>
    </ul>
  </div>
</template>

<script>
import { useArrayPagination } from "vue-composable";

export default {
  setup() {
    const array = new Array(1000).fill(0).map((_, i) => i);
    const { result, next, prev, currentPage, lastPage } = useArrayPagination(
      array,
      {
        pageSize: 3
      }
    );

    return { result, next, prev, currentPage, lastPage };
  }
};
</script>

Contributing

  • Fork it!
  • Create your feature branch: git checkout -b feat/new-composable
  • Commit your changes: git commit -am 'feat(composable): add a new composable'
  • Push to the branch: git push origin feat/new-composable
  • Submit a pull request

License

MIT

FAQs

Package last updated on 13 Jan 2020

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