diff options
Diffstat (limited to 'src/components/style_switcher/style_switcher.js')
| -rw-r--r-- | src/components/style_switcher/style_switcher.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/components/style_switcher/style_switcher.js b/src/components/style_switcher/style_switcher.js new file mode 100644 index 00000000..8a8cc2a0 --- /dev/null +++ b/src/components/style_switcher/style_switcher.js @@ -0,0 +1,20 @@ +import StyleSetter from '../../services/style_setter/style_setter.js' + +export default { + data: () => ({ + availableStyles: [], + selected: false + }), + created () { + const self = this + window.fetch('/static/css/themes.json') + .then((data) => data.json()) + .then((themes) => { self.availableStyles = themes }) + }, + watch: { + selected () { + const fullPath = `/static/css/${this.selected}` + StyleSetter.setStyle(fullPath) + } + } +} |
