我使用语义ui日历与Vuejs结合来获得价值.在使用datepicker选择日期后,此日历未设置该值.所以我无法通过Vuejs保存日期.这是我的HTML:
我的Vuejs:
var app = new Vue({ el: "#app", data: { input: { unique_number:"", date: "", description: "" }, inputErrors: [] } });
任何的想法 ?
试试下面的代码
var app = new Vue({
el: "#app",
data: {
input: {
unique_number: '',
date: '',
description: ''
},
inputErrors: []
},
methods: {
refreshCalendar: function () {
$('#date').calendar('set date', this.input.date)
}
},
mounted() {
$('#date').calendar({
onChange: function(date, text, mode) {
console.log('change: ' + date + " text: " + text + " mode: " + mode)
app.input.date = text
}
});
}
});
output (look at mounted onchange part)
date: {{input.date}}
input (look at refreshCalendar method)
if the value is changed somewhere else (like in this simple input text) call refreshCalendar