Skip to content
On this page

VueUse

1、简介

TIP

VueUse是一个基于Composition API的实用程序函数集合。

2、官网

https://vueuse.org/

3、使用要求

TIP

  • v4.0开始,它通过vue-demi的强大功能在单个包中适用于Vue 2Vue3

  • v6.0开始,VueUse需要vue >= v3.2@vue/composition-api >= v1.1

4、安装

4.1、npm

shell
npm i @vueuse/core

4.2、CDN

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

4.3、Nuxt

shell
npm i -D @vueuse/nuxt @vueuse/core

Nuxt3

ts
// nuxt.config.ts
export default defineNuxtConfig({
  modules: [
    '@vueuse/nuxt',
  ],
})

Nuxt2

ts
// nuxt.config.js
export default {
  buildModules: [
    '@vueuse/nuxt',
  ],
}

Released under the MIT License.