mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-02-20 09:38:23 +08:00
📝 update doc
This commit is contained in:
parent
458ddaa167
commit
b1c7f309f8
@ -40,7 +40,6 @@ def funcA():
|
||||
```python
|
||||
from nonebot.plugin import export
|
||||
|
||||
|
||||
export=export()
|
||||
```
|
||||
|
||||
@ -49,12 +48,15 @@ export=export()
|
||||
```python
|
||||
export.vA = varA
|
||||
export.fA = funcA
|
||||
```
|
||||
|
||||
除此之外,也支持 `嵌套` 导出对象:
|
||||
|
||||
```python
|
||||
export.sub.vA = varA
|
||||
export.sub.fA = funcA
|
||||
```
|
||||
|
||||
特别地,对于 `函数对象` 而言,`export` 支持用 `装饰器` 的方法来导出,因此,我们可以这样定义 `funcA`:
|
||||
|
||||
```python
|
||||
@ -110,5 +112,6 @@ require_A = require('pluginA')
|
||||
```python
|
||||
varA = require_A.vA
|
||||
funcA = require_A.fA or require_A.funcA
|
||||
```
|
||||
|
||||
这样,我们就在 `pluginB` 中成功导入了 `varA` 和 `funcA` 对象了。
|
||||
|
Loading…
x
Reference in New Issue
Block a user