Laydate markデータのリアルタイム更新の問題
2292 ワード
laydateのmarkを使用してスケジュールを管理する場合、切替時間がmark値を変更すると常にタイムリーに更新できず、公式に提供されたchangイベントは常にページがマウントされた後に呼び出され、データがタイムリーに更新できない.そこで、ネットで解決策を探してみましたが、beforechangeイベントを追加する解決策を提供した神様がいましたが、この方法は上下切替時のみ有効で、直接時間を選択した場合は有効ではありません.以下に、私自身の解決策を示します.
ステップ1:laydateを修正する.js
T.prototype.Changeイベント、returnを
T.prototype.Listは、n.range‖n.done(null,“change”)文の前の段落を次のように変更します.
次に、beforeChangeでデータ要求を呼び出し、markを更新する方法(要求データに同期要求が必要であることに注意)
ステップ1:laydateを修正する.js
T.prototype.Changeイベント、returnを
return {
prevYear: function() {
s("sub") || (a.year--,
n.range || t.done(null, "beforeChange"),
t.checkDate("limit").calendar(),
n.range || t.done(null, "change"))
},
prevMonth: function() {
var e = t.getAsYM(a.year, a.month, "sub");
w.extend(a, {
year: e[0],
month: e[1]
}),
n.range || t.done(null, "beforeChange"),
t.checkDate("limit").calendar(),
n.range || t.done(null, "change")
},
nextMonth: function() {
var e = t.getAsYM(a.year, a.month);
w.extend(a, {
year: e[0],
month: e[1]
}),
n.range || t.done(null, "beforeChange"),
t.checkDate("limit").calendar(),
n.range || t.done(null, "change")
},
nextYear: function() {
s() || (a.year++,
n.range || t.done(null, "beforeChange"),
t.checkDate("limit").calendar(),
n.range || t.done(null, "change"))
}
}
T.prototype.Listは、n.range‖n.done(null,“change”)文の前の段落を次のように変更します.
"year" === a.type || "month" === a.type ?
(w(d).find("." + o).removeClass(o), w(this).addClass(o), "month" === a.type && "year" === e && (n.listYM[t][0] = r, l && (n[["startDate", "endDate"][t]].year = r), n.list("month", t)))
: (n.range || n.done(null, "beforeChange"),
n.checkDate("limit").calendar(),
n.closeList()),
// a.range || n.done(null, "change"),
n.setBtnStatus(),
次に、beforeChangeでデータ要求を呼び出し、markを更新する方法(要求データに同期要求が必要であることに注意)
beforeChange:function (value, date) {
_this.year = date.year;
_this.month = date.month;
_this.endDays = laydate.getEndDate(date.month, date.year);
_this.changeCount = 'changed';
_this.selectRc();
_this.myLaydate.config.mark = _this.obj;
},