improvement: popup add open event

This commit is contained in:
thinkinggis 2020-01-21 11:56:04 +08:00
parent f2279e54a0
commit 4599a845e4
4 changed files with 53 additions and 3 deletions

View File

@ -88,7 +88,6 @@ scene.addMarkerLayer(layer);
```javascript
scene.removeMarkerLayer(layer);
```
### demo 地址

View File

@ -1,6 +1,6 @@
---
title: Popup
order: 4
title: popup
order: 0
---
# popup
@ -60,6 +60,14 @@ var html =
popup.setHtml(html);
```
#### setDOMContent
- 参数 htmlNode dom 对象
区别于 setHtml 对象只能传字符串
**tips**
如果需要将 react 组件渲染到 popup 可以用此方法。
#### setText
设置 popup 显示文本内容
@ -67,6 +75,20 @@ popup.setHtml(html);
```javascript
popup.setText('hello world');
```
#### open
显示popup
```javascript
popup.open();
```
#### close
显示popup
```javascript
popup.close();
```
#### remove
@ -78,12 +100,19 @@ popup.remove();
## 事件
### open
```javascript
popup.on('open', () => {});
```
#### close
```javascript
popup.on('close', () => {});
```
## 示例代码
#### 添加 popup

View File

@ -75,6 +75,20 @@ popup.setHtml(html);
```javascript
popup.setText('hello world');
```
#### open
显示popup
```javascript
popup.open();
```
#### close
显示popup
```javascript
popup.close();
```
#### remove
@ -86,12 +100,19 @@ popup.remove();
## 事件
### open
```javascript
popup.on('open', () => {});
```
#### close
```javascript
popup.on('close', () => {});
```
## 示例代码
#### 添加 popup

View File

@ -44,6 +44,7 @@ export default class Popup extends EventEmitter implements IPopup {
this.mapsService.on('click', this.onClickClose);
}, 30);
}
this.emit('open');
return this;
}