App.jsx
Home
/
FileServer /
Web /
Scripts /
React /
App.jsx
class App extends React.Component {
constructor(props) {
super(props);
console.log('App start');
//this.state = { counter: 0 };
this.OnItemsChange = this.OnItemsChange.bind(this);
this.SetID = this.SetID.bind(this);
this.GetID = this.GetID.bind(this);
//Получить ID из url
var Url_ID = new URL(window.location.href).
searchParams.get("ID");
if (Url_ID != null)
this.SetID(Url_ID);
//if (this.props.match != undefined
// && this.props.match.params != undefined
// && this.props.match.params.ID != undefined)
// this.SetID(this.props.match.params.ID);
//Получить id от родительского компонента
else if (this.props.ID != undefined)
this.SetID(this.props.ID);
}
OnItemsChange() {
this.refs.FileExplorerControl.
LoadDirectory();
}
SetID(val)
{
this.CurrentID = val;
console.log(this.CurrentID);
}
GetID()
{
return this.CurrentID;
}
render() {
return (
<div>
<UserControl ref="UserControl"
ParentComponent={this}
/>
<hr />
<FileExplorerControl ref="FileExplorerControl"
ParentComponent={this}
GetID={this.GetID} SetID={this.SetID}
OnItemsChange={this.OnItemsChange}
OnItemsChangesObservers_Register={this.OnItemsChangesObservers_Register}
/>
<hr />
<ExplorerActionsControl ref="ExplorerActionsControl"
ParentComponent={this}
/>
<hr />
<UploaderControl ref="UploaderControl"
ParentComponent={this}
GetID={this.GetID}
OnItemsChange={this.OnItemsChange}
/>
<hr />
<BootstrapControl
/>
<hr />
</div>
);
}
}