比如说这篇文档:
搜索结果
可以考虑把这个步骤的最后返回值 由文本改为 JSON 格式
如果使用表达式实现,需要将 menuData 的默认值改为对应的 JSON
$=
if (String.IsNullOrWhiteSpace({searchResult})){
dynamic json = new JObject();
dynamic item = new JObject();
dynamic childs = JArray.Parse({menuData});
// 生成单条搜索结果
item.Title = {title};
item.Description = {hpath};
item.Data = "callback:" + {id};
item.DataType = "path";
item.Operation = "callback";
item.Children = childs;
json.Items = new JArray(item);
return json;
} else {
dynamic json = JToken.Parse({searchResult});
dynamic item = new JObject();
dynamic childs = JArray.Parse({menuData});
// 生成单条搜索结果
item.Title = {title};
item.Description = {hpath};
item.Data = "callback:" + {id};
item.DataType = "path";
item.Operation = "callback";
item.Children = childs;
json.Items.Add(item);
return json;
}
[
{
"Icon": "fa:Light_Copy",
"Title": "复制可读路径",
"Data": "复制可读路径"
},
{
"Icon": "fa:Light_Text",
"Title": "复制markdown链接",
"Data": "复制markdown链接"
},
{
"Icon": "fa:Light_Copy",
"Title": "复制id",
"Data": "复制id"
},
{
"Icon": "fa:Light_Text",
"Title": "复制标题",
"Data": "复制标题"
},
{
"Icon": "fa:Light_Copy",
"Title": "复制可读路径",
"Data": "复制可读路径"
}
]
PS:感谢老铁的动作,之前从来没有想过用 quicker 的搜索框
谢谢老铁建议,空了改~