docs: add tip for using global method in setup (#8647)

This commit is contained in:
neverland
2021-05-02 11:16:14 +08:00
committed by GitHub
parent 4d27e8b969
commit 511b316074
3 changed files with 9 additions and 3 deletions
+3 -1
View File
@@ -79,7 +79,7 @@ Notify({
### 全局方法
通过 `app.use` 注册 Notify 组件后,会自动在 app 的所有子组件上挂载 `$notify` 方法,便于在组件内调用。
通过 `app.use` 全局注册 Notify 组件后,会自动在 app 的所有子组件上挂载 `$notify` 方法,便于在组件内调用。
```js
export default {
@@ -89,6 +89,8 @@ export default {
};
```
> Tips: 由于 setup 选项中无法访问 this,因此不能使用上述方式,请通过 import 引入。
### 组件调用
如果需要在 Notify 内嵌入组件或其他自定义内容,可以使用组件调用的方式。