BookStack/resources/js/components/setting-color-picker.js

20 lines
675 B
JavaScript
Raw Normal View History

2022-11-15 12:44:57 +00:00
import {Component} from "./component";
2022-11-15 12:44:57 +00:00
export class SettingColorPicker extends Component {
2022-11-15 12:44:57 +00:00
setup() {
this.colorInput = this.$refs.input;
this.resetButton = this.$refs.resetButton;
this.defaultButton = this.$refs.defaultButton;
this.currentColor = this.$opts.current;
this.defaultColor = this.$opts.default;
this.resetButton.addEventListener('click', () => this.setValue(this.currentColor));
this.defaultButton.addEventListener('click', () => this.setValue(this.defaultColor));
}
2022-11-15 12:44:57 +00:00
setValue(value) {
this.colorInput.value = value;
this.colorInput.dispatchEvent(new Event('change'));
}
}