在 Kendo UI 调度程序上响应式更改视图
Change view responsively on Kendo UI Scheduler
我有这个使用 Kendo UI 调度程序的应用程序,我现在有两个视图:
views: [
{ type: "day", selected: false, majorTick: majorTick },
{ type: "week", selected: true, majorTick: majorTick },
]
问题是如果用户使用移动设备,我需要将视图更改为 day
,否则将其保留在 week
。
如有任何帮助,我们将不胜感激。
好吧,我找到了这个解决方案,首先我检查应用程序是否在移动设备中,如下所示:
detectmobile(): boolean {
if (navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)
|| (window.innerWidth <= 800 && window.innerHeight <= 600)) {
return true;
}
else {
return false;
}
}
然后我简单地锻炼我的布尔值:
let detectMobile = this.detectmobile();
let isDay = detectMobile;
let isWeek = !detectMobile;
最后我把它们喂给 jQuery("#scheduler").kendoScheduler
:
views: [
{ type: "day", selected: isDay, majorTick: majorTick },
{ type: "week", selected: isWeek, majorTick: majorTick },
],
我有这个使用 Kendo UI 调度程序的应用程序,我现在有两个视图:
views: [
{ type: "day", selected: false, majorTick: majorTick },
{ type: "week", selected: true, majorTick: majorTick },
]
问题是如果用户使用移动设备,我需要将视图更改为 day
,否则将其保留在 week
。
如有任何帮助,我们将不胜感激。
好吧,我找到了这个解决方案,首先我检查应用程序是否在移动设备中,如下所示:
detectmobile(): boolean {
if (navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)
|| (window.innerWidth <= 800 && window.innerHeight <= 600)) {
return true;
}
else {
return false;
}
}
然后我简单地锻炼我的布尔值:
let detectMobile = this.detectmobile();
let isDay = detectMobile;
let isWeek = !detectMobile;
最后我把它们喂给 jQuery("#scheduler").kendoScheduler
:
views: [
{ type: "day", selected: isDay, majorTick: majorTick },
{ type: "week", selected: isWeek, majorTick: majorTick },
],