Blame view

src/layout/components/Settings/index.vue 2.37 KB
yuanshuhui authored
1
2
3
<template>
  <div class="drawer-container">
    <div>
yuanshuhui authored
4
      <h3 class="drawer-title">{{ $t('settings.title') }}</h3>
yuanshuhui authored
5
6

      <div class="drawer-item">
yuanshuhui authored
7
        <span>{{ $t('settings.theme') }}</span>
yuanshuhui authored
8
9
10
11
        <theme-picker style="float: right;height: 26px;margin: -3px 8px 0 0;" @change="themeChange" />
      </div>

      <div class="drawer-item">
yuanshuhui authored
12
        <span>{{ $t('settings.tagsViews') }}</span>
yuanshuhui authored
13
14
15
16
        <el-switch v-model="tagsView" class="drawer-switch" />
      </div>

      <div class="drawer-item">
yuanshuhui authored
17
        <span>{{ $t('settings.fixedHeader') }}</span>
yuanshuhui authored
18
19
20
21
        <el-switch v-model="fixedHeader" class="drawer-switch" />
      </div>

      <div class="drawer-item">
yuanshuhui authored
22
        <span>{{ $t('settings.showLogo') }}</span>
yuanshuhui authored
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
        <el-switch v-model="sidebarLogo" class="drawer-switch" />
      </div>

    </div>
  </div>
</template>

<script>
import ThemePicker from '@/components/ThemePicker'

export default {
  components: { ThemePicker },
  data() {
    return {}
  },
  computed: {
yuanshuhui authored
39
40
41
    isShowJob() {
      return this.$store.getters.language === 'zh'
    },
yuanshuhui authored
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
    fixedHeader: {
      get() {
        return this.$store.state.settings.fixedHeader
      },
      set(val) {
        this.$store.dispatch('settings/changeSetting', {
          key: 'fixedHeader',
          value: val
        })
      }
    },
    tagsView: {
      get() {
        return this.$store.state.settings.tagsView
      },
      set(val) {
        this.$store.dispatch('settings/changeSetting', {
          key: 'tagsView',
          value: val
        })
      }
    },
    sidebarLogo: {
      get() {
        return this.$store.state.settings.sidebarLogo
      },
      set(val) {
        this.$store.dispatch('settings/changeSetting', {
          key: 'sidebarLogo',
          value: val
        })
      }
    },
yuanshuhui authored
75
76
77
    lang() {
      return this.$store.getters.language
    }
yuanshuhui authored
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
  },
  methods: {
    themeChange(val) {
      this.$store.dispatch('settings/changeSetting', {
        key: 'theme',
        value: val
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.drawer-container {
  padding: 24px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;

  .drawer-title {
    margin-bottom: 12px;
    color: rgba(0, 0, 0, .85);
    font-size: 14px;
    line-height: 22px;
  }

  .drawer-item {
    color: rgba(0, 0, 0, .65);
    font-size: 14px;
    padding: 12px 0;
  }

  .drawer-switch {
    float: right
  }
}
</style>