In Vue, how do I bind a date object to a date input ? (v-model doesn't work)

前端 未结 1 493
傲寒
傲寒 2021-01-15 18:36
// This doesn\'t work

How can I bind a date input to a date object in my store?

相关标签:
1条回答
  • 2021-01-15 19:24

    Assuming you want your dates as midnight UTC date objects, do this...

    <input type='date'
        :value='store.myDate.toJSON().substring(0,10)'
        @input='store.myDate = new Date($event.target.value)'
    >
    
    0 讨论(0)
提交回复
热议问题