All Projects → mobxjs → Mobx Vue

mobxjs / Mobx Vue

Licence: mit
🐉 Vue bindings for MobX

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Mobx Vue

Mobx React
React bindings for MobX
Stars: ✭ 4,814 (+1100.5%)
Mutual labels:  reactive-programming, mobx
Mobx
Simple, scalable state management.
Stars: ✭ 24,636 (+6043.64%)
Mutual labels:  reactive-programming, mobx
react-mobx-router5
React components for routing solution using router5 and mobx
Stars: ✭ 58 (-85.54%)
Mutual labels:  mobx, reactive-programming
Vueflux
♻️ Unidirectional State Management Architecture for Swift - Inspired by Vuex and Flux
Stars: ✭ 315 (-21.45%)
Mutual labels:  reactive-programming
Mobx Remotedev
MobX DevTools extension
Stars: ✭ 317 (-20.95%)
Mutual labels:  mobx
React home
这是一个react得demo/脚手架项目,包含react16+redux+antd+webpack4+react-router4+sass/less+axios+proxy技术栈
Stars: ✭ 356 (-11.22%)
Mutual labels:  mobx
Starcabinet
🎉 开源的跨平台Github Stars管理分析工具
Stars: ✭ 399 (-0.5%)
Mutual labels:  mobx
Coderplanets web
the most sexiest community for developers, build with React, Mobx/MST, GraphQL, Styled-Components, Rxjs, Ramda ... and ❤️
Stars: ✭ 314 (-21.7%)
Mutual labels:  mobx
Recycle
Convert functional/reactive object description using RxJS into React component
Stars: ✭ 374 (-6.73%)
Mutual labels:  reactive-programming
Formily
Alibaba Group Unified Form Solution -- Support React/ReactNative/Vue2/Vue3
Stars: ✭ 6,554 (+1534.41%)
Mutual labels:  mobx
Core
Most.js core event stream
Stars: ✭ 342 (-14.71%)
Mutual labels:  reactive-programming
Springy Store Microservices
Springy Store is a conceptual simple μServices-based project using the latest cutting-edge technologies, to demonstrate how the Store services are created to be a cloud-native and 12-factor app agnostic. Those μServices are developed based on Spring Boot & Cloud framework that implements cloud-native intuitive, design patterns, and best practices.
Stars: ✭ 318 (-20.7%)
Mutual labels:  reactive-programming
Formstate
❤️ Form state so simple that you will fall in love 🌹
Stars: ✭ 357 (-10.97%)
Mutual labels:  mobx
Reactive Practice At Taobao
♨️ Reactive @ 淘宝 | Reactive实践、推动、落地的记录与大会分享 | Flow Arch(流式架构)/Reactive Programming(RP/反应式编程)
Stars: ✭ 314 (-21.7%)
Mutual labels:  reactive-programming
Ordinary Puzzles App
Mobile and web puzzle game built with React-Native
Stars: ✭ 376 (-6.23%)
Mutual labels:  mobx
Awesome Rxjs
A collection of awesome RxJS resources
Stars: ✭ 314 (-21.7%)
Mutual labels:  reactive-programming
Rpd
👌 A Minimal Engine for creating Node-Based Visual Programming User Interfaces
Stars: ✭ 370 (-7.73%)
Mutual labels:  reactive-programming
Rxswift
RxSwift를 스터디하는 공간
Stars: ✭ 335 (-16.46%)
Mutual labels:  reactive-programming
Learn Rxjs
Clear examples, explanations, and resources for RxJS
Stars: ✭ 3,475 (+766.58%)
Mutual labels:  reactive-programming
Token Wizard
(Discontinued) TokenWizard is an DApp to create and manage crowdsale and token contracts using a simple UI
Stars: ✭ 353 (-11.97%)
Mutual labels:  mobx

mobx-vue

npm version coverage npm downloads Build Status

Vue bindings for MobX, inspired by mobx-react

logo

Installation

npm i mobx-vue -S

or

yarn add mobx-vue

Requirement

  • Vue >= 2.0.0
  • MobX >= 2.0.0, compatible with MobX 5!

Why mobx-vue

MobX is an unopinionated, scalable state management, which can make our programming more intuitive.

Unlike the other vue-rx-inspired libraries which based on the plugin mechanism of vue, mobx-vue will be the simplest you ever meet. What you all need is to bind your state in component definition and observe it just like mobx-react does, then your component will react to your state changes automatically which managed by mobx.

And, the most important is that you can build a view-library-free application, if you wanna migrate to another view library(React/Angular) someday, rewrite the template and switch to the relevant mobx bindings(mobx-react,mobx-angular,mobx-angularjs) is all you have to do.

Articles:

Usage

We highly recommend using the bindings with vue-class-component decorator, and define the Store/ViewModel independently.

import { action, computed, observable } from "mobx";
export default class ViewModel {
    @observable age = 10;
    @observable users = [];

    @computed get computedAge() {
        return this.age + 1;
    }

    @action.bound setAge() {
        this.age++;
    }
    
    @action.bound async fetchUsers() {
    	this.users = await http.get('/users')
    }
}
<template>
    <section>
        <p v-text="state.age"></p>
        <p v-text="state.computedAge"></p>
        <p v-for="user in state.users" :key="user.name">{{user.name}}</p>
        <button @click="state.setAge"></button>
    </section>
</template>

<script lang="ts">
    import Vue from "vue";
    import Component from "vue-class-component";
    import { Observer } from "mobx-vue";
    import ViewModel from "./ViewModel";

    @Observer
    @Component
    export default class App extends Vue {
        state = new ViewModel()
        mounted() { 
            this.state.fetchUsers();
        }
    }
</script>

Or used with the traditional way:

<script lang="ts">
    import { observer } from "mobx-vue";
    import ViewModel from "./ViewModel";

    export default observer({
        data() {
            return { state: new ViewModel() }
        },
        mounted() {
            this.state.fetchUsers() 
        }
    })
</script>

All you need is to bind your state to component and observe it. No more reactive data definitions in component.

Tips: If you're tired of instantiating instance manually every time, you might wanna try the mmlpx library which leveraged a dependency injection system.

API

  • observer((VueComponent | options): ExtendedVueComponent
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].