revuejs
🐇 A tiny, light and handy state management for vuejs 2, writing less verbose code.
Installation
Install the pkg with npm:
npm install revuejs --save
or yarn
yarn add revuejs
or bower
bower install revuejs
You can also hot-link the CDN version: https://unpkg.com/revuejs/dist/index.js, Revuejs
is exposed to window
object.
Basic Uasage
1. create a module
// hello.js namespace: 'hello' state: title: 'hello' actions: { // return a new state return Object; } async { await Promise; iferr return msg: 'request error' return title: 'async test' ; }
2. create modules using the module you created
// modules/index.js;; Vue; ;; const modules = hello otherModule // others; ;
3. use it with Vue instance
;; // ... const app = // ... modules // ...;app;
4. combine Revuejs with Vue components
<template> <div> <h3>title</h3> <button @click="update">update title</button> </div></template> <script> ; computed: ... // or // ...mergeProps({ // test: 'hello.title', // }) methods: ... { this; } </script>
Docs
Examples
Running the examples:
npm install
npm run dev # serve examples at localhost:8000
Thanks
Thanks to vuex for the head start.
LICENSE
MIT