ParamMap
矩阵参数(;)和查询参数(?)。
Matrix and Query parameters.
interface ParamMap {
keys: string[]
has(name: string): boolean
get(name: string): string | null
getAll(name: string): string[]
}
说明
ParamMap 让参数更容易使用,因为它们可以有一个值或多个值。 因为用户原本就该知道有一个还是多个,所以请通过调用 get 或 getAll 来返回正确的类型(string 或 string[])。
ParamMap makes it easier to work with parameters as they could have either a single value or multiple value. Because this should be known by the user, calling get or getAll returns the correct type (either string or string[]).
该 API 的设计受到了 URLSearchParams 接口的启发。 参见 https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
The API is inspired by the URLSearchParams interface. see https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
属性
| 属性 | 说明 |
|---|---|
keys: string[] | 只读 所有参数名的数组。 Name of the parameters |
方法
返回具有指定参数名的单一值。 Return a single value for the given parameter name: |
|
返回指定参数名的值数组。 Return an array of values for the given parameter name. |
如果没有该参数,则返回一个空数组。 If there is no such parameter, an empty array is returned. |