@3yourmind/vue-hooks 中文文档教程

发布于 3年前 浏览 25 项目主页 更新于 3年前

vue-hooks NPM Version Build Status Code Coverage

⚡️ 很棒的 Vue 挂钩

使用 @vue/composition-api 实现有用的 Vue 挂钩。
Vue 3.0 还没有发布,它允许你提前使用基于功能的组件。

⚠️ 2.x 已经切换到 @vue/composition-api,如果你使用的是 1.x 版本请使用 vue-function-api

Install

yarn add @vue/composition-api @u3u/vue-hooks

Documentation Netlify Status

文档位于 https://vue-hooks.netlify。 com

Usage

编辑 Vue Hooks 示例

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

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b feat/new-hook
  3. Commit your changes: git commit -am 'feat(hooks): add a new hook'
  4. Push to the branch: git push origin feat/new-hook
  5. Submit a pull request :D

Contributors

感谢这些优秀的人(emoji key):

u3u
u3u

???? ???? ???? ⚠️

这个项目遵循all-contributors规格。 欢迎任何形式的贡献!

License

麻省理工学院

vue-hooks NPM Version Build Status Code Coverage

⚡️ 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 Netlify Status

Docs are available at https://vue-hooks.netlify.com

Usage

Edit Vue Hooks Examples

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

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b feat/new-hook
  3. Commit your changes: git commit -am 'feat(hooks): add a new hook'
  4. Push to the branch: git push origin feat/new-hook
  5. Submit a pull request :D

Contributors

Thanks goes to these wonderful people (emoji key):

u3u
u3u

???? ???? ???? ⚠️

This project follows the all-contributors specification. Contributions of any kind are welcome!

License

MIT

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文