• Stars
    star
    110
  • Rank 316,770 (Top 7 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ˜„ โญ ๐Ÿ˜‡ Mobx binding for Vuejs 2.

build pass npm-version license bower-license

vue-mobx

Mobx binding for Vue.

Only supports Vuejs 2.x & Mobx 2.2.x or higher.

Installation

Install the pkg with npm:

npm install vue-mobx --save

or yarn

yarn add vue-mobx

or bower

bower install vue-mobx

Usage

Obviously it works with Mobx and Vuejs, install via NPM: npm i --save mobx vue vue-mobx:

1. install vue-mobx plugin:

// entry.js
import Vue from 'vue';
import {observable, isObservable, toJS} from 'mobx';
import VueMobx from 'vue-mobx';

Vue.use(VueMobx, {
    toJS: toJS, // must
    isObservable: isObservable, // must
    observable: observable,  // optional
});

2. create models:

// create models

import {observable, action} from 'mobx';

class Test {
    @observable
    count = 0;

    @action.bound
    changeCount(){
        ++this.count;
    }
}

const test = new Test();
export default test;

3. use models in vue component:

// in vue component
<template>
    <div>
        <p>count: {{count}}</p>
        <p @click="changeCount">Update</p>
    </div>
</template>    
<script>
    import testModel from './mobx/test';

    export default {
        fromMobx: {
            testModel
        }
    }
</script>

There is a full example.

LICENSE

MIT

More Repositories

1

blog

๐Ÿถ ๐Ÿ‘ ๐ŸŒŸ Welcome to star
JavaScript
3,782
star
2

front-end-handbook

Front-end Developer HandBook. Read online: https://dwqs.gitbooks.io/frontenddevhandbook/content/
CSS
605
star
3

area-data

ไธญๅ›ฝ็œๅธ‚ๅŒบๆ•ฐๆฎ(ๅซๆธฏๆพณๅฐ)
JavaScript
482
star
4

vue-area-linkage

็œๅธ‚ๅŒบ่”ๅŠจ้€‰ๆ‹ฉ: https://dwqs.github.io/vue-area-linkage/
Vue
477
star
5

vue-to-react

๐Ÿ› ๏ธ ๐Ÿ‘‰ Try to transform Vue component to React component
JavaScript
431
star
6

area-puppeteer

ๅŸบไบŽ puppeteer ็š„ไธญๅ›ฝ่กŒๆ”ฟๅŒบๅŸŸๆŠ“ๅ–็ˆฌ่™ซ
JavaScript
169
star
7

react-style-guide

A mostly reasonable approach to React and JSX
157
star
8

v2-table

A simple table component based Vue 2.x: https://dwqs.github.io/v2-table/
Vue
100
star
9

js2excel

๐Ÿ˜Œ ๐Ÿ˜ƒ ๐Ÿ‘ฟ A simple module for excel and json converts each other, which works in the browser.
TypeScript
99
star
10

v2-datepicker

A simple datepicker component based Vue 2.x: https://dwqs.github.io/v2-datepicker/
JavaScript
90
star
11

tech-read

Grab tech articles daily from UGC communities
JavaScript
77
star
12

react-native-image-viewer

A pure JavaScript image viewer component for react-native apps with pan, pinch.etc, supporting both iOS and Android.
JavaScript
67
star
13

codewars-practices

Some best practices for practice questions on codewars, update it weekly
67
star
14

react-area-linkage

็œๅธ‚ๅŒบ่”ๅŠจ้€‰ๆ‹ฉ: https://dwqs.github.io/react-area-linkage/
JavaScript
61
star
15

react-virtual-list

A tiny virtualization list component(gzipped 6KB), supports dynamic height: https://dwqs.github.io/react-virtual-list/
JavaScript
46
star
16

vue-startup

A template with webpack 4 + vuejs 2 + + babel 7 setup for projects startup
JavaScript
43
star
17

chare

A simple CLI scaffolding for front-end projects
JavaScript
35
star
18

vue-resume

A Personal Resume Template is powered by Vue,Node.js & Webpack:http://resume.ido321.com
Vue
34
star
19

react-demos

Some react demos for myself: https://dwqs.github.io/react-demos
JavaScript
33
star
20

node-style-guide

A guide for styling your node.js / JavaScript code.
32
star
21

v2-lazy-list

A simple lazy-load list component based Vue 2.x: https://dwqs.github.io/v2-lazy-list/
JavaScript
31
star
22

mp-jithub

Mini program for Github
Vue
30
star
23

vue-typescript

A template with webpack 4 + vuejs 2 + typescript 2 setup for projects startup
TypeScript
27
star
24

revuejs

๐Ÿ‡ A tiny, light and handy state management for vuejs 2, writing less verbose code.
JavaScript
24
star
25

vue-toast

A toast component written with Vue, designed based on Ant Design [deprecated]
Vue
18
star
26

webpack-mpvue-startup

A template with webpack 3 + mpvue 1 setup for projects startup
JavaScript
14
star
27

beautify-scrollbar

Beautify browser's scrollbars: https://dwqs.github.io/beautify-scrollbar/index
JavaScript
13
star
28

lue

๐ŸŒฑ Vue and vuex based library, writing less verbose code.
JavaScript
12
star
29

mpvue-markdown-parser

A markdown parser for mpvue
JavaScript
9
star
30

nx

A hexo theme based on landscape-plus
CSS
9
star
31

babel-plugin-on-demand-import

Babel plugin for importing components on demand
JavaScript
9
star
32

react-startup

A template with webpack 4 + react 16 + react-router 4 + babel 7 setup for projects startup
JavaScript
8
star
33

chrome-extension-for-wiki

๐Ÿ” ๐Ÿฎ ๐Ÿผ Add awesome article link to your wiki repo on github quickly./ๅฟซ้€ŸๆทปๅŠ ๆ–‡็ซ ้“พๆŽฅๅˆฐ wiki repo ็š„ chrome ๆ‰ฉๅฑ•
JavaScript
7
star
34

async-await-error-handling

Error handling friendly for async/await in ts and js
JavaScript
7
star
35

reproto

A tool for generate simple random password which contains letters, number and special characters
JavaScript
6
star
36

icons

Some interesting icon & design implemented by pure css.
5
star
37

orbithub

A chrome extensition for convenient github search
JavaScript
5
star
38

redux-actions-promise

๐Ÿฐ ๐Ÿฑ ๐Ÿป FSA-compliant promise middleware for Redux, supports referencing dispatcher/state in action.
TypeScript
5
star
39

maoxuan

ๆ•™ๅ‘˜้€‰้›†้˜…่ฏป็ฌ”่ฎฐ
5
star
40

tiny-dom-helpers

๐ŸŒœ ๐ŸŒš ๐ŸŒ› Tiny dom helpers, supports IE9 +.
JavaScript
5
star
41

scroll-on-webview

ๅค„็† webview ไธŠ็š„ๆปšๅŠจ
JavaScript
4
star
42

infine

A chrome extension for theme color replacement of Github
CSS
4
star
43

note

Personal note sites, write what you want, support markdown: http://note.ido321.com/
JavaScript
3
star
44

view-star-packages-on-npm

View your star packages on npmjs.com: https://dwqs.github.io/view-star-packages-on-npm
JavaScript
3
star
45

async-react-compoment

๐Ÿ˜Ž ๐Ÿ‘€ ๐Ÿ™ˆ Async component loaded based webpack 3 for react-router 4.[unmaintained]
TypeScript
2
star
46

gitlang

Repository to list all programming languages github supports
JavaScript
2
star