admin-theme.component.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. 'use strict'
  2. export default {
  3. name: 'admin-theme',
  4. props: ['themedata'],
  5. data() {
  6. return {
  7. primary: 'indigo',
  8. alt: 'blue-grey',
  9. footer: 'blue-grey',
  10. codedark: 'true',
  11. codecolorize: 'true'
  12. }
  13. },
  14. methods: {
  15. saveTheme() {
  16. let self = this
  17. this.$http.post(window.location.href, self.$data).then(resp => {
  18. self.$store.dispatch('alert', {
  19. style: 'green',
  20. icon: 'check',
  21. msg: 'Theme settings have been applied successfully.'
  22. })
  23. }).catch(err => {
  24. self.$store.dispatch('alert', {
  25. style: 'red',
  26. icon: 'square-cross',
  27. msg: 'Error: ' + err.body.msg
  28. })
  29. })
  30. },
  31. resetTheme() {
  32. this.primary = 'indigo'
  33. this.alt = 'blue-grey'
  34. this.footer = 'blue-grey'
  35. this.codedark = 'true'
  36. this.codecolorize = 'true'
  37. }
  38. },
  39. mounted() {
  40. let theme = JSON.parse(this.themedata)
  41. this.primary = theme.primary
  42. this.alt = theme.alt
  43. this.footer = theme.footer
  44. this.codedark = theme.code.dark.toString()
  45. this.codecolorize = theme.code.colorize.toString()
  46. }
  47. }