javascript - Fullcalendar 从 3.x 迁移到 4.x extraParams 不会将多个输入作为数组操作
问题描述
我正在尝试从 fullcalendar 3.x 迁移到 4.x
<select id="ids" name="ids[]" class="form-control" multiple>
<option value="1" selected> Option 1</option>
<option value="2"> Option 2</option>
<option value="3"> Option 3</option>
</select>
<button type="button" id="btn-filter">Apply</button>
在 3.x 版本中,data
里面的参数events
被正确地管理为数组:
这是我的 Firefox 控制台:
array_ids[]:
0: 1
1: 2
start: 2019-06-01T00:00:00
end: 2019-07-01T00:00:00
一段代码:
events: {
url: './get-events.php',
cache: false,
type: 'POST',
data: function() { // a function that returns an object
return {
array_ids: $("#ids").val()
};
}
error: function () {
alert('there was an error while fetching events!');
},
},
现在使用此代码转换为 4.x 后:
events: {
url: './get-events.php',
cache: false,
method: 'POST', <--- type -> method
extraParams: function() {
return {
array_ids: $("#ids").val()
};
}
},
我的 Firefox 控制台显示:
array_ids: 1,2 //as string
解决方案
推荐阅读
- python - 该应用程序使用 UWSGI 和 Flask (tiangolo/uwsgi-nginx-flask) 在生产模式下运行两次
- postgresql - Postgres:带有时区的时间戳类型的无效输入语法:“”
- sql - 使用 SQL 汇总数据
- css - Web 配置和 IIS
- excel - Excel宏上的元素相乘
- typescript - 嵌入另一个泛型的 TypeScript 泛型
- c# - 可以在 ApiMember 属性和 xmldoc 摘要注释中使用相同的描述吗?
- vue.js - 制表符:在单元格焦点上加载编辑器参数
- android - 如何从输入法服务更改导航栏的颜色?
- c# - 如何使用 user32.dll 将 VB 转换为 CSharp?