From 8a6a2a343bf70890dc98ba3ea5950e47881231c3 Mon Sep 17 00:00:00 2001 From: dolymood Date: Thu, 11 Oct 2018 16:45:50 +0800 Subject: [PATCH] docs(singleton): about create-api singleton changes --- document/components/docs/en-US/singleton.md | 10 +++++++++- document/components/docs/zh-CN/singleton.md | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/document/components/docs/en-US/singleton.md b/document/components/docs/en-US/singleton.md index d80a736d..a0aebb40 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 3dfa4a08..1abf4f0d 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 调用的组件都是弹层类,经常使用的如下: -- GitLab