mirror of
https://github.com/woodchen-ink/clash-and-dashboard.git
synced 2025-07-18 14:01:56 +08:00
Fix: selector & rerender
This commit is contained in:
parent
ac6bac65aa
commit
3bf124dbb3
@ -40,10 +40,6 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
|||||||
hasCreateDropList: false
|
hasCreateDropList: false
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor (props) {
|
|
||||||
super(props)
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
document.addEventListener('click', this.handleGlobalClick, true)
|
document.addEventListener('click', this.handleGlobalClick, true)
|
||||||
this.setState({ dropdownListStyles: this.calculateAttachmentPosition() })
|
this.setState({ dropdownListStyles: this.calculateAttachmentPosition() })
|
||||||
@ -91,8 +87,7 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
top: Math.floor(targetRectInfo.top) - 10,
|
top: Math.floor(targetRectInfo.top) - 10,
|
||||||
left: Math.floor(targetRectInfo.left) - 10,
|
left: Math.floor(targetRectInfo.left) - 10
|
||||||
width: Math.floor(targetRectInfo.width) + 10
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,10 +47,10 @@ class Proxies extends React.Component<ProxiesProps, ProxiesState> {
|
|||||||
<Icon type="plus" size={20} style={{ fontWeight: 'bold' }} />
|
<Icon type="plus" size={20} style={{ fontWeight: 'bold' }} />
|
||||||
</Header>
|
</Header>
|
||||||
{
|
{
|
||||||
config.state === 'ok' && <ul className="proxies-list">
|
config.config.proxy.length !== 0 && <ul className="proxies-list">
|
||||||
{
|
{
|
||||||
config.config.proxy.map((p, index) => (
|
config.config.proxy.map((p, index) => (
|
||||||
<li key={index}>
|
<li key={p.name}>
|
||||||
<Proxy config={p} onEdit={() => this.setState({
|
<Proxy config={p} onEdit={() => this.setState({
|
||||||
showModifyProxyDialog: true,
|
showModifyProxyDialog: true,
|
||||||
activeConfig: p,
|
activeConfig: p,
|
||||||
@ -65,15 +65,15 @@ class Proxies extends React.Component<ProxiesProps, ProxiesState> {
|
|||||||
<div className="proxies-container">
|
<div className="proxies-container">
|
||||||
<Header title={t('groupTitle')} />
|
<Header title={t('groupTitle')} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{
|
|
||||||
showModifyProxyDialog && <ModifyProxyDialog
|
|
||||||
config={activeConfig}
|
|
||||||
onOk={this.handleConfigApply}
|
|
||||||
onCancel={() => this.setState({ showModifyProxyDialog: false, activeConfig: null, activeConfigIndex: -1 })}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{
|
||||||
|
showModifyProxyDialog && <ModifyProxyDialog
|
||||||
|
config={activeConfig}
|
||||||
|
onOk={this.handleConfigApply}
|
||||||
|
onCancel={() => this.setState({ showModifyProxyDialog: false, activeConfig: null, activeConfigIndex: -1 })}
|
||||||
|
/>
|
||||||
|
}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user