2
0
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 ()

* 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:
Mr.Bai 2021-06-27 15:51:57 +08:00 committed by GitHub
parent 21a132241d
commit 4401d4954f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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
}