diff options
| author | Roger Braun <roger@rogerbraun.net> | 2017-01-16 18:57:03 +0100 |
|---|---|---|
| committer | Roger Braun <roger@rogerbraun.net> | 2017-01-16 18:57:03 +0100 |
| commit | d644887d4cb2c5d5a4d4b008a2d63dce1cb90bb1 (patch) | |
| tree | 79fee98e20e391f314f81289fa1f51f7c69c56ec /src/components | |
| parent | afd90b84d0257f158bba5e9fbcc233f807bc15f6 (diff) | |
Add styleSwitcher.
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/style_switcher/style_switcher.js | 20 | ||||
| -rw-r--r-- | src/components/style_switcher/style_switcher.vue | 7 |
2 files changed, 27 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) + } + } +} diff --git a/src/components/style_switcher/style_switcher.vue b/src/components/style_switcher/style_switcher.vue new file mode 100644 index 00000000..8c32ed07 --- /dev/null +++ b/src/components/style_switcher/style_switcher.vue @@ -0,0 +1,7 @@ +<template> + <select v-model="selected"> + <option v-for="style in availableStyles" >{{style}}</option> + </select> +</template> + +<script src="./style_switcher.js"></script> |
