---
title: "appendQueryParam"
description: "追加查询参数(不覆盖已有同名参数)"
seo_title: "appendQueryParam"
seo_description: "Append a query parameter to a URL without replacing existing values of the same name, returning a new URL string with the value added."
canonical_url: "https://core.mhaibaraai.cn/docs/utilities/url/append-query-param"
---
# appendQueryParam

> 追加查询参数(不覆盖已有同名参数)

## 用法

`appendQueryParam` 函数用于追加查询参数(不覆盖已有同名参数)。

```ts
import { appendQueryParam } from '@movk/core'

appendQueryParam('https://example.com?tag=a', 'tag', 'b')
// 'https://example.com?tag=a&tag=b'
```

## API

### `appendQueryParam(url, key, value)`

追加查询参数(不覆盖已有同名参数)。

### 参数

**url** (`string`) *required*: URL 字符串。

**key** (`string`) *required*: 参数名。

**value** (`QueryParamValue`) *required*: 参数值。

### 返回值

**返回值** (`string`): 新的 URL 字符串。

## Changelog

See commit history for [src/utilities/url/query.ts](https://github.com/mhaibaraai/movk-core/commits/main/src/utilities/url/query.ts).


## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
