import { Popups, useController } from 'lbl-popups' import { Observer, useLocalStore } from 'mobx-react' import { FC } from 'react' import { Nat } from 'src/model/nat' import styles from './index.module.scss' type Data = Pick interface Props { defaultValue?: Data } const NatEdit: FC = (props) => { const ctl = useController() const localStore = useLocalStore(() => { return { port: props.defaultValue?.port || '', subdomian: props.defaultValue?.subdomain || '', local_host: props.defaultValue?.local_host || '', bindOnChange: (key: string) => { return (e: any) => { localStore[key] = e.target.value } }, } }) return ( {() => (
创建内网穿透
{ ctl.close({ port: localStore.port, subdomain: localStore.subdomian, local_host: localStore.local_host, }) }} > 确定
)}
) } export function openNatEdit(props?: Props): Promise { return Popups.open({ el: NatEdit, position: 'center', props, }) }