代码改变世界

vue.js使用laydate

2018-05-28 11:54  vz深渊  阅读(1837)  评论(0)    收藏  举报

 

<div id='app'>

开始时间:<input type='text' id='start' v-on:focus='getDate'>

{{startTime }}

</div>

 

<script>

var vue = new Vue({

  el: '#app',

  data: { startTime: '' },

  methods: {

    getDate: function () {

    var that = this;
    laydate({

      elem: '#start',
      choose: function (date) {

        that.startTime = date;
      }
    });
  }
}

});

laydate({
  elem: '#start',
  event: 'focus'
});

</script>