项目
在 GitHub 查看 vue-hooks
Documentation
u3u/vue-hooks
关于
⚡️超棒的 Vue Hooks
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文vue-hooks

⚡️ Awesome Vue Hooks
Using @vue/composition-api to implement useful vue hooks.
Vue 3.0 has not been released yet, it allows you to use functional-based components in advance.
⚠️ 2.x has been switched to @vue/composition-api, if you are using version 1.x please use vue-function-api
Install
yarn add @vue/composition-api @u3u/vue-hooks
Documentation 
Docs are available at https://vue-hooks.netlify.com
Usage
import Vue from 'vue';
import VueCompositionAPI from '@vue/composition-api';
import hooks from '@u3u/vue-hooks';
Vue.use(hooks);
Vue.use(VueCompositionAPI); // Don't forget to use the plugin!
import { createComponent } from '@vue/composition-api';
import { useWindowSize } from '@u3u/vue-hooks';
export default createComponent({
setup() {
const { width, height, widthPixel, heightPixel } = useWindowSize();
return { width, height, widthPixel, heightPixel };
},
render() {
const { width, height, widthPixel, heightPixel } = this;
return (
<div id="app" style={{ width: widthPixel, height: heightPixel }}>
dynamic window size: {width}, {height}
</div>
);
},
});
Hooks
useDate— Usingdayjsto process date.useWindowSize— Trackswindowdimensions.useCounter— Tracks state of a number.usePrevious— Returns the previous state or props.useRouter— A hook forvue-router.useStore— A hook forvuex.useState— A hook formapState.useGetters— A hook formapGetters.useMutations— A hook formapMutations.useActions— A hook formapActions.
Contributing
- Fork it!
- Create your feature branch:
git checkout -b feat/new-hook - Commit your changes:
git commit -am 'feat(hooks): add a new hook' - Push to the branch:
git push origin feat/new-hook - Submit a pull request :D
Contributors
Thanks goes to these wonderful people (emoji key):
u3u 💻 📖 💡 ⚠️ |
This project follows the all-contributors specification. Contributions of any kind are welcome!
License
探索相关项目
加载中…