Blame view

ant-design-vue-jeecg/src/utils/mixin.js 1.01 KB
肖超群 authored
1
// import Vue from 'vue'
肖超群 authored
2
import {mapState} from "vuex";
肖超群 authored
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

// const mixinsComputed = Vue.config.optionMergeStrategies.computed
// const mixinsMethods = Vue.config.optionMergeStrategies.methods

const mixin = {
  computed: {
    ...mapState({
      layoutMode: state => state.app.layout,
      navTheme: state => state.app.theme,
      primaryColor: state => state.app.color,
      colorWeak: state => state.app.weak,
      multipage: state => state.app.multipage,//多页签设置
      fixedHeader: state => state.app.fixedHeader,
      fixSiderbar: state => state.app.fixSiderbar,
      contentWidth: state => state.app.contentWidth,
      autoHideHeader: state => state.app.autoHideHeader,
      sidebarOpened: state => state.app.sidebar.opened
    })
  }
}

const mixinDevice = {
  computed: {
    ...mapState({
      device: state => state.app.device,
    })
  },
  methods: {
肖超群 authored
31
    isMobile() {
肖超群 authored
32
33
      return this.device === 'mobile'
    },
肖超群 authored
34
    isDesktop() {
肖超群 authored
35
36
37
38
39
      return this.device === 'desktop'
    }
  }
}
肖超群 authored
40
export {mixin, mixinDevice}