1. import Vue from "vue";
    2. const Store = function Store(options = {}) {
    3. const { state = {}, mutations = {} } = options;
    4. this._vm = new Vue({
    5. data: {
    6. $$state: state
    7. }
    8. });
    9. this._mutations = mutations;
    10. };
    11. Store.prototype.commit = function (type, payload) {
    12. if (this._mutations[type]) {
    13. this._mutations[type](this.state, payload);
    14. }
    15. };
    16. Object.defineProperties(Store.prototype, {
    17. state: {
    18. get: function () {
    19. return this._vm._data.$$state;
    20. }
    21. }
    22. });
    23. export default { Store };