0.5.1 • Published 4 years ago

vx-hook v0.5.1

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

vx-hook

umi-hooks为模板的 vue-hook 实现

Install

yarn add vx-hook

or

npm i --save vx-hook

当前vue 版本为 3.0.0-beta.1

Usage

组件内使用

<template>
  <div class="home">

    <div>
      <Card style='margin: 20% auto; width: 600px' title=''>
        <h2> {{ state.name }} </h2>
        <div> default:  {{ state.age }} </div>
        <div> throttle: {{ info }} </div>
        <Button @click='add' > add </Button>
      </Card>
    </div>
    
  </div>
</template>

<script>
import { reactive } from 'vue'
import { useThrottle } from 'vx-hook'


export default {

  setup(){
    const state = reactive({name: 'jeck', age: 23})
    const add = () => state.age += 1
    const [ info ] = useThrottle(() => state.age, 1000) // 防抖hook

   return {
     add,
     state,
     info,
   }

  }

}
</script>

Hooks

UI

SideEffect

State

Cache

Dom

Animations

0.5.1

4 years ago

0.3.0

4 years ago

0.4.0

4 years ago

0.3.1

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.0.1

4 years ago