0.2.0 • Published 6 years ago

easy-vuex v0.2.0

Weekly downloads
2
License
ISC
Repository
-
Last release
6 years ago

easy-vuex

简介

适用于小型Vue应用的数据管理。可以全局共享部分数据和方法,既不需要像Vuex那样额外写一些mutation,又不需要采用Vue传统的props/events来通讯。

使用示例

Vue.use(require('easy-vuex'), {
    state: {
        foo: 'bar',
    },
    getters: {
        computedFoo () {
            return this.foo + 'hey';
        }
    },
    actions: {
        setFoo () {
            this.foo = 'baz';
            var that = this;
            setTimeout(function () {
            	that.foo = 'bar';
            }, 1000);
        }
    }
});
<div @click="$actions.setFoo">{{ $state.foo }}{{ $getters.computedFoo }}</div>

会作用于全局,js代码里可以通过this.$state等访问数据和方法。

0.2.0

6 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago