egoist
8/15/2016 - 8:45 AM

esnextbin sketch

esnextbin sketch

'use strict';

var _autosize = require('autosize');

var _autosize2 = _interopRequireDefault(_autosize);

var _vue = require('vue');

var _vue2 = _interopRequireDefault(_vue);

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

var AutosizeTextarea = {
  props: ['handleChange', 'value'],
  template: '<textarea @input="handleChange" >{{ value }}</textarea>',
  ready: function ready() {
    (0, _autosize2.default)(this.$el);
  }
};

var app = {
  template: '<autosize-textarea :handle-change="handleChange" :value="text"></autosize-textarea>',
  components: {
    AutosizeTextarea: AutosizeTextarea
  },
  data: function data() {
    return {
      text: 'hi'
    };
  },

  methods: {
    handleChange: function handleChange(e) {

      this.text = e.target.value;
      console.log(this.text);
    }
  }
};

new _vue2.default({
  el: 'body',
  components: { app: app }
});
{
  "name": "esnextbin-sketch",
  "version": "0.0.0",
  "dependencies": {
    "autosize": "3.0.17",
    "vue": "1.0.26"
  }
}
import autosize from 'autosize'
import Vue from 'vue'

const AutosizeTextarea = {
  props: ['handleChange', 'value'],
  template: `<textarea @input="handleChange" >{{ value }}</textarea>`,
  ready() {
    autosize(this.$el)
  }
}

const app = {
  template: '<autosize-textarea :handle-change="handleChange" :value="text"></autosize-textarea>',
  components: {
    AutosizeTextarea
  },
  data() {
    return {
      text: 'hi'
    }
  },
  methods: {
    handleChange(e) {
      
      this.text = e.target.value
      console.log(this.text)
    }
  }
}

new Vue({
  el: 'body',
  components: {app}
})
<!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>