fn
useArrayJoin
v0.0.14testeddemoReactive Array.prototype.join, with an optional reactive separator.
Example
ts
const list = ref(['a', 'b', 'c']);
const sep = ref('-');
const joined = useArrayJoin(list, sep); // 'a-b-c'Demo
Loading demo…
Signature
ts
export function useArrayJoin(
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<unknown>>>,
separator?: MaybeRefOrGetter<string>,
): UseArrayJoinReturn{ ... }Parameters
| Parameter | Type | Description |
|---|---|---|
list | MaybeRefOrGetter<Array<MaybeRefOrGetter<unknown>>> | The source array (items can be reactive) |
separator? | MaybeRefOrGetter<string> | A reactive separator placed between adjacent elements (defaults to ,) |
Returns
UseArrayJoinReturnA computed string of all elements joined; empty string when the array is empty