GithubHelp home page GithubHelp logo

wangliangxin / vueuse Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vueuse/vueuse

0.0 0.0 0.0 11.54 MB

Collection of essential Vue Composition Utilities for Vue 2 and 3

Home Page: https://vueuse.org

License: MIT License

Shell 0.02% JavaScript 0.28% TypeScript 84.45% CSS 0.61% HTML 0.05% Vue 14.59%

vueuse's Introduction

VueUse - Collection of essential Vue Composition Utilities VueUse - Collection of essential Vue Composition Utilities
Collection of essential Vue Composition Utilities

NPM version NPM Downloads Docs & Demos Function Count
GitHub stars

๐Ÿš€ Features

  • ๐ŸŽช Interactive docs & demos
  • ๐Ÿ•ถ Seamless migration: Works for both Vue 3 and 2
  • โšก Fully tree shakeable: Only take what you want, bundle size
  • ๐Ÿฆพ Type Strong: Written in TypeScript, with TS Docs
  • ๐Ÿ”‹ SSR Friendly
  • ๐ŸŒŽ No bundler required: Usable via CDN
  • ๐Ÿ”ฉ Flexible: Configurable event filters and targets
  • ๐Ÿ”Œ Optional Add-ons: Router, Firebase, RxJS, etc.

๐Ÿฆ„ Usage

import { useLocalStorage, useMouse, usePreferredDark } from '@vueuse/core'

export default {
  setup() {
    // tracks mouse position
    const { x, y } = useMouse()

    // if user prefers dark theme
    const isDark = usePreferredDark()

    // persist state in localStorage
    const store = useLocalStorage(
      'my-storage',
      {
        name: 'Apple',
        color: 'red',
      },
    )

    return { x, y, isDark, store }
  },
}

Refer to functions list or documentations for more details.

๐Ÿ“ฆ Install

๐ŸŽฉ From v4.0, it works for Vue 2 & 3 within a single package by the power of vue-demi!

npm i @vueuse/core

Add ons | Nuxt Module

From v6.0, VueUse requires vue >= v3.2 or @vue/composition-api >= v1.1

Demos

CDN

<script src="https://unpkg.com/@vueuse/shared"></script>

<script src="https://unpkg.com/@vueuse/core"></script>

It will be exposed to global as window.VueUse

๐Ÿชด Project Activity

Alt

๐Ÿงฑ Contribute

See the Contributing Guide

๐ŸŒธ Thanks

This project is heavily inspired by the following awesome projects.

And thanks to all the contributors on GitHub!

๐Ÿ‘จโ€๐Ÿš€ Contributors

Financial Contributors on Open Collective

๐Ÿ“„ License

MIT License ยฉ 2019-PRESENT Anthony Fu

vueuse's People

Contributors

antfu avatar okxiaoliang4 avatar webfansplz avatar wheatjs avatar alfred-skyblue avatar renovate[bot] avatar sibbng avatar scottbedard avatar anteriovieira avatar doctor-wu avatar cawa-93 avatar patak-dev avatar vaakian avatar chaii3 avatar curtgrimes avatar sun0day avatar michealroberts avatar azaleta avatar sxzz avatar lstoeferle avatar huynl-96 avatar huiliangshen avatar waleed-kh avatar ferferga avatar harmyderoman avatar shinigami92 avatar wvffle avatar btea avatar userquin avatar jbaubree avatar

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.