Client Related
Composables APIs
hasGlobalComponent
Check whether a component is registered globally.
TIP
- Local import of the component does not affect the result.
- When calling outside
setup
scope, you need to pass theapp
instance as the second parameter.
export const hasGlobalComponent: (name: string, app?: App) => boolean
Example
// if you globally register `<my-component>`
hasGlobalComponent('MyComponent') // true
hasGlobalComponent('my-component') // true
hasGlobalComponent('MyComponent2') // false
useLocaleConfig
Get current locale config from locales settings.
export const useLocaleConfig: <T extends LocaleData>(
localesConfig: RequiredLocaleConfig<T>,
) => ComputedRef<T>
Example
const localesCOnfig = {
'/': 'Title',
'/zh/': '标题',
}
const locale = useLocaleConfig(localesConfig)
// under `/page`
locale.value // 'Title'
// under `/zh/page`
locale.value // '标题'