```javascript
const createDialog = () => {
  const { Dialog, Button } = weappUi;
  const wrap = document.createElement('div');
  wrap.setAttribute('id', 'dialogid_0001');
  document.body.appendChild(wrap);//创建
  const destroy = () => {
    const _div = document.getElementById(`dialogid_0001`);
    if (!_div) return false;
    const unmount = ReactDOM.unmountComponentAtNode(_div);
    if (unmount && _div.parentNode) {
      _div.parentNode.removeChild(_div);
    }
    return true;
  };
  const onOk = () => {
    alert('ok')
    destroy();
  }
  const dlg = <Dialog
    visible
    title={'title'}
    placement="middle"
    closable
    destroyOnClose
    draggable
    maskClosable
    mask
    onClose={destroy}
    width={500}
    footer={[
      <Button onClick={onOk}>Ok</Button>
    ]}
  >
    123123
  </Dialog>
  ReactDOM.render(dlg, wrap);
}
// 注册到window
window.Cutsom_createDialog = createDialog;

//按钮里再执行
//const dlgRef = window.Cutsom_createDialog(); // 打开弹框
//dlgRef.destroy?.(); //销毁弹框
```
