JSFiddle - React, Tailwind, and code Playground

by Edward Tanguay

HTML

<div id="app">
  <input v-model="startTime" v-on:keyup="validateTime(startTime)"/>
  <div>
  {{errorMessage}}
  </div>
</div>

JavaScript

var vm = new Vue({
	el: '#app',
	data: function() {
		return {
			startTime: 'hello',
      errorMessage: ''
		}
	},
  mounted: function() {
  	this.validateTime(startTime);
  },
	methods: {
		validateTime: function(time) {
    	this.errorMessage = 'the length is ' + time.length;
		}
	}
});
// vm.validateTime(vm.startTime); // WORKS BUT IS NOT IN AN INTERNAL HOOK