mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-06 12:17:13 +08:00
feat:(message): add useMessage usage link of prerequisite (#304)
* feat:(message): add useMessage usage link of prerequisite * Update src/message/src/use-message.ts Co-authored-by: 07akioni <07akioni2@gmail.com>
This commit is contained in:
parent
21a132241d
commit
4401d4954f
@ -10,6 +10,7 @@
|
||||
|
||||
- `n-carousel` supports touch operation, closes [#271](https://github.com/TuSimple/naive-ui/issues/271).
|
||||
- `n-input` add `input-props` prop.
|
||||
- `n-message` optimize the error message of `useMessage` when there is no `n-message-provider`, add the related document link.
|
||||
|
||||
### Fixes
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
## Pending
|
||||
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- `n-select` 的 `SelectOption` `render` 属性被重命名为 `renderLabel`
|
||||
@ -11,6 +10,7 @@
|
||||
|
||||
- `n-carousel` 支持触控操作,关闭 [#271](https://github.com/TuSimple/naive-ui/issues/271)
|
||||
- `n-input` 新增 `input-props` 属性
|
||||
- `n-message` 优化 `useMessage` 当没有 `n-message-provider` 时的报错信息,增加关联的文档链接
|
||||
|
||||
### Fixes
|
||||
|
||||
|
@ -6,7 +6,10 @@ import type { MessageApiInjection } from './MessageProvider'
|
||||
export function useMessage (): MessageApiInjection {
|
||||
const api = inject(messageApiInjectionKey, null)
|
||||
if (api === null) {
|
||||
throwError('use-message', 'No outer <n-message-provider /> founded.')
|
||||
throwError(
|
||||
'use-message',
|
||||
'No outer <n-message-provider /> founded. See prerequisite in https://www.naiveui.com/en-US/os-theme/components/message for more details. If you want to use `useMessage` outside setup, please check https://www.naiveui.com/zh-CN/os-theme/components/message#Q-&-A.'
|
||||
)
|
||||
}
|
||||
return api
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user