All Projects → dwqs → Revuejs

dwqs / Revuejs

Licence: mit
🐇 A tiny, light and handy state management for vuejs 2, writing less verbose code.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Revuejs

Vue Entity Adapter
Package to maintain entities in Vuex.
Stars: ✭ 20 (-20%)
Mutual labels:  state-management, vuejs2
Vuex Namespaced Module Structure
📈 A Vue.js project powered by Vuex namespaced modules in a simple structure based on Large-scale Vuex application structures
Stars: ✭ 146 (+484%)
Mutual labels:  modules, vuejs2
Vuex Feature Scoped Structure
📈 Feature scoped Vuex modules to have a better organization of business logic code inside Vuex modules based on Large-scale Vuex application structures @3yourmind
Stars: ✭ 218 (+772%)
Mutual labels:  modules, vuejs2
Vue Chat
👥Vue全家桶+Socket.io+Express/Koa2打造一个智能聊天室。
Stars: ✭ 887 (+3448%)
Mutual labels:  vuejs2
Inherited builder
🤖Autogenerated state management and dependency injection with inherited widgets
Stars: ✭ 17 (-32%)
Mutual labels:  state-management
Vue Meteor
🌠 Vue first-class integration in Meteor
Stars: ✭ 893 (+3472%)
Mutual labels:  vuejs2
Larastrator
All in one - admin panel with tailwindcss and vuejs.
Stars: ✭ 25 (+0%)
Mutual labels:  vuejs2
Flutter Provide
A simple framework for state management in Flutter.
Stars: ✭ 824 (+3196%)
Mutual labels:  state-management
Vue Filter Date Parse
Simple date parsing filter for Vue.js
Stars: ✭ 24 (-4%)
Mutual labels:  vuejs2
Modules
📦 Modules package for Laravel
Stars: ✭ 900 (+3500%)
Mutual labels:  modules
Elfi
An elegant state container for your JavaScript applications
Stars: ✭ 18 (-28%)
Mutual labels:  state-management
React Eventmanager
[Deprecated] Event-based simple React state management with decorators
Stars: ✭ 17 (-32%)
Mutual labels:  state-management
Harvest
zec cash mining dashboard for the harvest project using nanopool.org
Stars: ✭ 22 (-12%)
Mutual labels:  vuejs2
Shop Web Mgt
管理系统后台
Stars: ✭ 25 (+0%)
Mutual labels:  vuejs2
Go Modiff
Command line tool for diffing go module dependency changes between versions 📔
Stars: ✭ 24 (-4%)
Mutual labels:  modules
Manhuaren
vue2.0全家桶,仿漫画人官网(移动端)
Stars: ✭ 18 (-28%)
Mutual labels:  vuejs2
Fuse
A simple file sharing web service in Vue.js and Flask
Stars: ✭ 7 (-72%)
Mutual labels:  vuejs2
Easy Vue
Learn vueJS Easily 👻
Stars: ✭ 896 (+3484%)
Mutual labels:  vuejs2
Pokedexvuejs
A Pokedex that will contain all 807 pokemon from the Pokemon series. Created in Vue.js
Stars: ✭ 19 (-24%)
Mutual labels:  vuejs2
Srvs
Zero dependency dev server
Stars: ✭ 25 (+0%)
Mutual labels:  modules

build pass js-standard-style npm-version license bower-license

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
export default {
    namespace: 'hello',
    state: {
        title: 'hello'
    },
    actions: {
        changeTitle(state, payload) {
            // return a new state
            return Object.assign({}, state, {
                title: payload.title
            });
        },

        async testAsync(state, payload) {
            await Promise.resolve(2);
            if(err) {
               return {
                   msg: 'request error'
               }
            }
            return {
                title: 'async test'
            };
        }
    }
}

2. create modules using the module you created

// modules/index.js
import Vue from 'vue';
import Revuejs, { Modules } from 'revuejs';

Vue.use(Revuejs);

import hello from 'path/to/hello';
import otherModule from 'path/to/other-module';

const modules = new Modules({
    hello,
    otherModule
    // others
});

export default modules;

3. use it with Vue instance

import Vue from 'vue';
import modules from 'path/to/modules/index';

// ...

const app = new Vue({
    // ...
    modules,
    // ...
});
app.$mount('#app');

4. combine Revuejs with Vue components

<template>
    <div>
        <h3>{{title}}</h3>
        <button @click="update">update title</button>
    </div>
</template>    
<script>
    import {mergeActions, mergeProps} from 'revuejs';

    export default {
        computed: {
            ...mergeProps(['hello.title', 'hello.info'])
            // or
            // ...mergeProps({
            //    test: 'hello.title',
            // })
        },

        methods: {
            ...mergeActions(['hello.changeTitle']),

            update(){
                this.changeTitle({
                    title: 'will be update title'
                });
            }
        }
    }
</script>   

Docs

View the docs here.

Examples

Running the examples:

npm install
npm run dev # serve examples at localhost:8000

Thanks

Thanks to vuex for the head start.

LICENSE

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].