JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 158
  • Score
    100M100P100Q84203F
  • License MIT

⚡️ Awesome Vue Hooks

Package Exports

  • @u3u/vue-hooks

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@u3u/vue-hooks) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

vue-hooks NPM Version Build Status Code Coverage

⚡️ Awesome Vue Hooks

Using vue-function-api to implement useful vue hooks.
Vue 3.0 has not been released yet, it allows you to use functional-based components in advance.

Install

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

Usage

import Vue from 'vue';
import { plugin } from 'vue-function-api';
import hooks from '@u3u/vue-hooks';

Vue.use(hooks);
Vue.use(plugin); // Don't forget to use the plugin!
import { createComponent } from 'vue-function-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