提交 f0e37598 编写于 作者: D dolymood

docs(create-api): about create-api instance remove doc

上级 32d306b6
......@@ -20,7 +20,7 @@ __Notice:__ All componnets which used `createAPI` must be registered by `Vue.use
- `const instance = this.$createAaBb(config, renderFn, single)`
Parameters:
**Parameters:**
| Attribute | Description | Type | Accepted Values | Default |
| - | - | - | - | - |
......@@ -28,7 +28,7 @@ __Notice:__ All componnets which used `createAPI` must be registered by `Vue.use
| renderFn | Optional, used to generate the VNode child node in the slot scene in general | Function | - | function (createElement) {...} |
| single | Optional, whether the instantiated component is a singleton or not. If two parameters are provided and the `renderFn`'s type is not function, then the `single` value is the sencond parameter's value. | Boolean | single in createAPI() | - |
Config options `config`:
**Config options `config`:**
It will be passed to the component as its props except the events in `events`(It will transform by default, eg: If `events` has value `['click']`, then the prop `onClick` will be treated as component's event and not component's props).
......@@ -69,9 +69,14 @@ __Notice:__ All componnets which used `createAPI` must be registered by `Vue.use
1. If `eventValue` is not a string value, then use `eventValue` as the event handler.
1. If `eventValue` is a string value, then use the caller's `eventValue` property value as the event handler.
The Returned value `instance`:
**The Returned value `instance`:**
`instance` is a instantiated Vue component,and the `remove` method will be **attached** to this instance.You can invoke the `remove` method to destroy the component and detach the component's content from `body` element. If the caller is destroyed and the `instance` will be destroyed too.
`instance` is a instantiated Vue component.
> And the `remove` method will be **attached** to this instance.
You can invoke the `remove` method to destroy the component and detach the component's content from `body` element.
If the caller is destroyed and the `instance` will be destroyed too.
- Example:
......
......@@ -19,7 +19,7 @@ __注:__ 所有通过 `createAPI` 实现的通过 API 的形式调用的自定
- `const instance = this.$createAaBb(config, renderFn, single)`
参数:
**参数:**
| 参数 | 说明 | 类型 | 默认值 | 示例 |
| - | - | - | - | - |
......@@ -27,7 +27,7 @@ __注:__ 所有通过 `createAPI` 实现的通过 API 的形式调用的自定
| renderFn | 可选参数,用于生成子 VNode 节点,一般场景是处理 slot | Function | - | function (createElement) {...} |
| single | 可选参数,创建的时候决定是否是单例的,优先级更高,如果没有传入 renderFn 的话,single 的值就是第二个参数的值 | Boolean | createAPI() 中传入的 single | - |
配置参数 `config`:
**配置参数 `config`:**
默认所有的值都会当做 props,但是要排除 createAPI 传入的 `events` 中的事件(默认会做转换,例如:`events` 的值为 `['click']`,那么 `config` 中的 `onClick` 就是作为 `click` 事件的回调函数,而不是作为 props 传递给组件)。
......@@ -68,9 +68,14 @@ __注:__ 所有通过 `createAPI` 实现的通过 API 的形式调用的自定
1. 如果 `eventValue` 是非字符串,则直接取配置的 `eventValue` 作为值
1. 如果 `eventValue` 是字符串,则直接获取当前实例上下文对应的 `eventValue` 的值
返回值 `instance`:
**返回值 `instance`:**
`instance` 就是组件实例,这个实例会被**附加**或者**代理** `remove` 方法,如果调用了,该实例就会被销毁且会从 `body` 下移除。如果说实例化上下文(即 `this.$createXx` 中的 `this`)销毁的话会自动移除销毁该实例元素。
`instance` 就是组件实例。
> 这个实例会被**附加或代理 `remove` 方法**
如果调用了,该实例就会被销毁且会从 `body` 下移除。
如果说实例化上下文(即 `this.$createXx` 中的 `this`)销毁的话会自动移除销毁该实例元素。
- 示例:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册