Skip to content

Commit 8a6a2a3

Browse files
committed
docs(singleton): about create-api singleton changes
1 parent 8a4a05c commit 8a6a2a3

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

document/components/docs/en-US/singleton.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
## Singleton Pattern
22

3-
You need to take the singleton and multiton pattern of components into account when invoking the component by API. If the component is singleton, then there will be only one instance when instantiating it multiple times, and there is only one corresponding view layer; If the component is multiton, then a new instance will be created each time you instantiate it, and there are multiple corresponding view layers which don't affect each other.
3+
You need to take the singleton and multiton pattern of components into account when invoking the component by API.
4+
5+
- After 1.11
6+
7+
If the component is singleton, then there will be only one instance when instantiating it multiple times **in same component**, and there is only one corresponding view layer; If the component is multiton, then a new instance will be created each time you instantiate it, and there are multiple corresponding view layers which don't affect each other.
8+
9+
- Below 1.11
10+
11+
If the component is singleton, then there will be only one instance when instantiating it multiple times, and there is only one corresponding view layer; If the component is multiton, then a new instance will be created each time you instantiate it, and there are multiple corresponding view layers which don't affect each other.
412

513
The components that are involved with api-invoking in cube-ui are all popups. Frequently used ones among them are listed below:
614

document/components/docs/zh-CN/singleton.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
## 单例模式
22

3-
通过 API 调用组件的时候,需要涉及到组件的单例、多例模式。如果说组件是单例的,在多次实例化的时候,只有一个实例,对应的视图层也只存在一份;如果说组件是多例的,那么每次实例化的时候都会产生一个新的实例,且对应的视图也是有多份的,它们之间互不影响。
3+
通过 API 调用组件的时候,需要涉及到组件的单例、多例模式。
4+
5+
- 1.11 版本之后
6+
7+
单例是相对于某一个组件上下文的,如果说组件是单例的,在同一个组件内多次实例化的时候,只有一个实例,对应的视图层也只存在一份;如果说组件是多例的,那么每次实例化的时候都会产生一个新的实例,且对应的视图也是有多份的,它们之间互不影响。
8+
9+
- 1.11 版本之前
10+
11+
如果说组件是单例的,在多次实例化的时候,只有一个实例,对应的视图层也只存在一份;如果说组件是多例的,那么每次实例化的时候都会产生一个新的实例,且对应的视图也是有多份的,它们之间互不影响。
412

513
在 cube-ui 中涉及到 API 调用的组件都是弹层类,经常使用的如下:
614

0 commit comments

Comments
 (0)