egoist
2/25/2016 - 10:37 AM

esnextbin sketch

esnextbin sketch

'use strict';

var _vue = require('vue');

var _vue2 = _interopRequireDefault(_vue);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

_vue2.default.mixin({
  created: function created() {
    var initialState = { count: 1 };
    if (this.$options.redux) {
      this.$options.redux.data.call(this._data, initialState);
    }
    console.log(this.$data);
  }
}); // write ES2015 code and import modules from npm
// and then press "Execute" to run your program

new _vue2.default({
  el: 'app',
  data: function data() {
    return { temp: true };
  },
  ready: function ready() {
    //console.log(this)
  },

  redux: {
    data: function data(state) {
      this.count = state.count;
    }
  }
});
{
  "name": "esnextbin-sketch",
  "version": "0.0.0",
  "dependencies": {
    "vue": "1.0.16"
  }
}
// write ES2015 code and import modules from npm
// and then press "Execute" to run your program
import Vue from 'vue'
Vue.mixin({
  created() {
    const initialState = {count: 1}
    if (this.$options.redux) {
      this.$options.redux.data.call(this._data, initialState)
    }
    console.log(this.$data)
  }
})

new Vue({
  el: 'app',
  data() {
    return {temp: true}
  },
  ready() {
    //console.log(this)
  },
  redux: {
    data(state) {
      this.count = state.count
    }
  }
})
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>ESNextbin Sketch</title>
  <!-- put additional styles and scripts here -->
</head>
<body>
  <app></app>
  <!-- put markup and other contents here -->
</body>
</html>