diff options
| author | Tusooa Zhu <tusooa@kazv.moe> | 2022-03-07 20:02:53 -0500 |
|---|---|---|
| committer | Tusooa Zhu <tusooa@kazv.moe> | 2022-03-07 20:02:53 -0500 |
| commit | 551b8f3690bab1f53ec22ccf6963009a30fa45d0 (patch) | |
| tree | bfec118e0eae92d65bb531a1ecf77f5ef2bdb56f /src/components/settings_modal/helpers/integer_setting.js | |
| parent | 48178bdc5334376a58edfe2ba06a2ee6c33d7815 (diff) | |
Fix "max depth in thread" setting
Diffstat (limited to 'src/components/settings_modal/helpers/integer_setting.js')
| -rw-r--r-- | src/components/settings_modal/helpers/integer_setting.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/components/settings_modal/helpers/integer_setting.js b/src/components/settings_modal/helpers/integer_setting.js new file mode 100644 index 00000000..fa6569ab --- /dev/null +++ b/src/components/settings_modal/helpers/integer_setting.js @@ -0,0 +1,37 @@ +import { get, set } from 'lodash' +import ModifiedIndicator from './modified_indicator.vue' +export default { + components: { + ModifiedIndicator + }, + props: { + path: String, + disabled: Boolean, + min: Number + }, + computed: { + pathDefault () { + const [firstSegment, ...rest] = this.path.split('.') + return [firstSegment + 'DefaultValue', ...rest].join('.') + }, + state () { + const value = get(this.$parent, this.path) + if (value === undefined) { + return this.defaultState + } else { + return value + } + }, + defaultState () { + return get(this.$parent, this.pathDefault) + }, + isChanged () { + return this.state !== this.defaultState + } + }, + methods: { + update (e) { + set(this.$parent, this.path, parseInt(e.target.value)) + } + } +} |
