2016-05-06 05:14:39 +08:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
export default class BaseMenu extends React.Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
2017-02-16 02:49:40 +08:00
|
|
|
this.handleUpdateSettings = props.handleUpdateSettings;
|
2016-05-06 05:14:39 +08:00
|
|
|
}
|
|
|
|
|
2017-02-16 02:49:40 +08:00
|
|
|
handleToggle(key) {
|
2017-06-03 03:25:02 +08:00
|
|
|
const obj = this.state;
|
2017-02-22 04:29:36 +08:00
|
|
|
obj.settings[key] = !this.state.settings[key];
|
2017-02-16 02:49:40 +08:00
|
|
|
|
|
|
|
this.setState(obj, () => {
|
2017-02-22 04:29:36 +08:00
|
|
|
this.handleUpdateSettings(this.state.settingsName, this.state.settings);
|
2017-02-16 02:49:40 +08:00
|
|
|
});
|
2016-05-06 05:14:39 +08:00
|
|
|
}
|
2024-06-13 00:06:07 +08:00
|
|
|
|
|
|
|
handleInput(key, e) {
|
|
|
|
const obj = this.state;
|
|
|
|
obj.settings[key] = e.target.value;
|
|
|
|
|
|
|
|
this.setState(obj, () => {
|
|
|
|
this.handleUpdateSettings(this.state.settingsName, this.state.settings);
|
|
|
|
});
|
|
|
|
}
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|