12月9

vueuse

| |
22:35 软件分析与设计  From: 本站原创
Tags:
阅读(198) | 评论(0) | 引用(0)
VueUse is a collection of utility functions based on Composition API. We assume you are already familiar with the basic ideas of Composition API before you continue.
https://vueuse.org/guide/

exp:
[codes=c#]
//npm i @vueuse/core
import { useMouse, usePreferredDark, useLocalStorage } from '@vueuse/core'

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

    // is 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 }
  }
}
[/codes]
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emot
打开HTML
打开UBB
打开表情
隐藏
记住我

昵称 : 

密码(可不填) :  游客无需密码

网址 (可不填) : 

电邮 (可不填) :  [注册]