-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1900257
commit df2751c
Showing
18 changed files
with
1,470 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# @vuepress/helper | ||
|
||
<NpmBadge package="@vuepress/helper" /> | ||
|
||
This package is a helper utility for VuePress developers. | ||
|
||
- `@vuepress/helper`: Node.js side helper utilities. | ||
|
||
- [Bundler Related](node/bundler.md) | ||
- [Page Related](node/page.md) | ||
|
||
- [`@vuepress/helper/client`](client.md): Client side helper utilities. | ||
- [`@vuepress/helper/shared`](shared.md): Utilities that are both available at Node.js side or Client. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Client Related | ||
|
||
## Composables APIs | ||
|
||
### hasGlobalComponent | ||
|
||
Check whether a component is registered globally. | ||
|
||
::: tip | ||
|
||
1. Local import of the component does not affect the result. | ||
1. When calling outside `setup` scope, you need to pass the `app` instance as the second parameter. | ||
|
||
::: | ||
|
||
```ts | ||
export const hasGlobalComponent: (name: string, app?: App) => boolean | ||
``` | ||
::: details Example | ||
```ts | ||
// if you globally register `<my-component>` | ||
hasGlobalComponent('MyComponent') // true | ||
hasGlobalComponent('my-component') // true | ||
|
||
hasGlobalComponent('MyComponent2') // false | ||
``` | ||
|
||
::: | ||
|
||
### useLocaleConfig | ||
|
||
Get current locale config from locales settings. | ||
|
||
```ts | ||
export const useLocaleConfig: <T extends LocaleData>( | ||
localesConfig: RequiredLocaleConfig<T>, | ||
) => ComputedRef<T> | ||
``` | ||
::: details Example | ||
```ts | ||
const localesCOnfig = { | ||
'/': 'Title', | ||
'/zh/': '标题', | ||
} | ||
|
||
const locale = useLocaleConfig(localesConfig) | ||
|
||
// under `/page` | ||
locale.value // 'Title' | ||
|
||
// under `/zh/page` | ||
locale.value // '标题' | ||
``` | ||
|
||
::: |
Oops, something went wrong.