diff --git a/document/components/docs/en-US/singleton.md b/document/components/docs/en-US/singleton.md index d80a736d3a7ce703324cdf69ea355a7f89f32b14..a0aebb408a00489a5e120b1f7d49e609b124d6a6 100644 --- a/document/components/docs/en-US/singleton.md +++ b/document/components/docs/en-US/singleton.md @@ -1,6 +1,14 @@ ## Singleton Pattern -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. +You need to take the singleton and multiton pattern of components into account when invoking the component by API. + +- After 1.11 + + 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. + +- Below 1.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. The components that are involved with api-invoking in cube-ui are all popups. Frequently used ones among them are listed below: diff --git a/document/components/docs/zh-CN/singleton.md b/document/components/docs/zh-CN/singleton.md index 3dfa4a08442dba8ff50185c3317ee7c6ea827a4e..1abf4f0db2dad7e300d2184194605562781ed803 100644 --- a/document/components/docs/zh-CN/singleton.md +++ b/document/components/docs/zh-CN/singleton.md @@ -1,6 +1,14 @@ ## 单例模式 -通过 API 调用组件的时候,需要涉及到组件的单例、多例模式。如果说组件是单例的,在多次实例化的时候,只有一个实例,对应的视图层也只存在一份;如果说组件是多例的,那么每次实例化的时候都会产生一个新的实例,且对应的视图也是有多份的,它们之间互不影响。 +通过 API 调用组件的时候,需要涉及到组件的单例、多例模式。 + +- 1.11 版本之后 + + 单例是相对于某一个组件上下文的,如果说组件是单例的,在同一个组件内多次实例化的时候,只有一个实例,对应的视图层也只存在一份;如果说组件是多例的,那么每次实例化的时候都会产生一个新的实例,且对应的视图也是有多份的,它们之间互不影响。 + +- 1.11 版本之前 + + 如果说组件是单例的,在多次实例化的时候,只有一个实例,对应的视图层也只存在一份;如果说组件是多例的,那么每次实例化的时候都会产生一个新的实例,且对应的视图也是有多份的,它们之间互不影响。 在 cube-ui 中涉及到 API 调用的组件都是弹层类,经常使用的如下: