add5200028aae56f54fb4f269504362943b352f9.svn-base 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <script>
  2. import { colorList } from '@/components/tools/setting'
  3. import ASwitch from 'ant-design-vue/es/switch'
  4. import AList from "ant-design-vue/es/list"
  5. import AListItem from "ant-design-vue/es/list/Item"
  6. import { mixin } from '@/utils/mixin.js'
  7. const Meta = AListItem.Meta
  8. export default {
  9. components: {
  10. AListItem,
  11. AList,
  12. ASwitch,
  13. Meta
  14. },
  15. mixins: [mixin],
  16. data () {
  17. return {
  18. }
  19. },
  20. filters: {
  21. themeFilter(theme) {
  22. const themeMap = {
  23. 'dark': '暗色',
  24. 'light': '白色'
  25. }
  26. return themeMap[theme]
  27. },
  28. },
  29. methods: {
  30. colorFilter(color) {
  31. const c = colorList.filter(o => o.color === color)[0]
  32. return c && c.key
  33. },
  34. onChange (checked) {
  35. if (checked) {
  36. this.$store.dispatch('ToggleTheme', 'dark')
  37. } else {
  38. this.$store.dispatch('ToggleTheme', 'light')
  39. }
  40. }
  41. },
  42. render () {
  43. return (
  44. <AList itemLayout="horizontal">
  45. <AListItem>
  46. <Meta>
  47. <a slot="title">风格配色</a>
  48. <span slot="description">
  49. 整体风格配色设置
  50. </span>
  51. </Meta>
  52. <div slot="actions">
  53. <ASwitch checkedChildren="暗色" unCheckedChildren="白色" defaultChecked={this.navTheme === 'dark' && true || false} onChange={this.onChange} />
  54. </div>
  55. </AListItem>
  56. <AListItem>
  57. <Meta>
  58. <a slot="title">主题色</a>
  59. <span slot="description">
  60. 页面风格配色: <a domPropsInnerHTML={ this.colorFilter(this.primaryColor) }/>
  61. </span>
  62. </Meta>
  63. </AListItem>
  64. </AList>
  65. )
  66. }
  67. }
  68. </script>
  69. <style scoped>
  70. </style>