---
title: "joinPath"
description: "将片段数组序列化为路径字符串"
canonical_url: "https://core.mhaibaraai.cn/docs/helpers/path/join-path"
---
# joinPath

> 将片段数组序列化为路径字符串

## 用法

`joinPath` 函数用于将片段数组序列化为路径字符串。

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

const p = joinPath(['a', 'x.y', 0, 'space key'])
// p: "a['x.y'][0]['space key']"
// 与解析往返:toPath(p) => ['a', 'x.y', 0, 'space key']
```

## API

### `joinPath(segments)`

将片段数组序列化为路径字符串。

### 参数

**segments** (`[string | number]()`) *required*: 路径片段数组。

### 返回值

**返回值** (`string`): 路径字符串。

## Changelog

See commit history for [src/helpers/path/joinPath.ts](https://github.com/mhaibaraai/movk-core/commits/main/src/helpers/path/joinPath.ts).

---

- [GitHub](https://github.com/mhaibaraai/movk-core/blob/main/src/helpers/path/joinPath.ts)


## Sitemap

See the full [sitemap](https://core.mhaibaraai.cn/sitemap.md) for all pages.
