外观
获取处理器
约 224 字小于 1 分钟
2026-02-04
获取所有处理器
getAllProcessors(category: string): processor[]
javascript
import mock from "@erhai_lake/mock-service"
const PROCESSORS = mock.getAllProcessors("string")
console.log(PROCESSORS)typescript
import mock, {type processor} from "@erhai_lake/mock-service"
const PROCESSORS: processor[] = mock.getAllProcessors("string")
console.log(PROCESSORS)返回
[
{
"id": "lower",
"title": "小写",
"description": "将字符串转换为小写",
"apply": "处理器 Function"
},
{
"id": "upper",
"title": "大写",
"description": "将字符串转换为大写",
"apply": "处理器 Function"
}
]获取某处理器
getProcessor(category: string, id: string): processor
javascript
import mock from "@erhai_lake/mock-service"
const PROCESSOR = mock.getProcessor("string", "substr")
console.log(PROCESSOR)typescript
import mock, {type processor} from "@erhai_lake/mock-service"
const PROCESSOR: processorInfo = mock.getProcessor("string", "substr")
console.log(PROCESSOR)返回
{
"id": "substr",
"title": "截取子字符串",
"description": "截取字符串的子字符串",
"params": [
{
"id": "start",
"title": "截取开始位置",
"description": "截取的开始位置",
"type": "number",
"default": 0,
"min": 0,
"step": 1
},
{
"id": "length",
"title": "截取长度",
"description": "截取的长度",
"type": "number",
"default": 10,
"min": 0,
"step": 1
}
],
"apply": "处理器 Function"
}版权所有
版权归属:Erhai-lake