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