我正在尝试用 javascript 记录函数的输入参数,但我无法在 jsdoc 中弄清楚如何做到这一点。
我查看了 jsdoc 文档,它表明使用@callback
注释是必需的,但 Visual Studio Code (vscode) 没有按照屏幕截图突出显示它。
location
参数的智能感知显示它是类型any
而不是类型locator
(带有参数的函数id
返回 a Location
)。
显示函数调用作为参数传递的函数的示例代码:
class Location {
constructor(position, count) {
this.position = position;
this.count = count;
}
}
const items = {
'USB Cable': new Location('Desk Drawer', 123),
Keyboard: new Location('Desk Surface', 1),
};
/**
* A locater.
* @param {string} id
* @returns {Location}
*/
const locaterA = id => items[id];
/**
* Finds the item …
Run Code Online (Sandbox Code Playgroud) 我正在尝试将Html.ListBoxFor()迁移到Html.Telerik().MultiSelectFor()以获得一些花哨的UI,但HTTP表单帖子与模型不兼容,并且似乎过多新模型粘合剂,以避免它.
public class Settings
{
public int[] UserIds { get; set; }
public IEnumerable<SelectListItem> UserSelectList { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
当我使用Html.ListBoxFor帮助程序时,HTTP表单post仅包含Select List Item的值(即UserIds数组),如预期的那样.
UserIds[0] = 1
UserIds[1] = 2
@Html.ListBoxFor(model => model.UserIds, Model.UserSelectList)
Run Code Online (Sandbox Code Playgroud)
当我使用Kendo MultiSelect时,HTTP表单帖子包含两个属性.这不是预期的.
UserIds[0].Text = Adrian
UserIds[0].Value = 1
...
@Kendo().MultiSelectFor(model => Model.UserIds).BindTo(Model.UserSelectList)
Run Code Online (Sandbox Code Playgroud)
有没有人知道如何让Kendo MultiSelect只发布id值,或者是否有现成的Model Binder?