// import Vue from 'vue' import {mapState} from "vuex"; // 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: { isMobile() { return this.device === 'mobile' }, isDesktop() { return this.device === 'desktop' } } } export {mixin, mixinDevice} import { mapGetters, mapMutations, mapActions } from 'vuex' /** * 歌曲列表 */ export const listMixin = { computed: { ...mapGetters(['playing', 'currentMusic']) }, methods: { selectItem(item, index) { if (item.id === this.currentMusic.id && this.playing) { this.setPlaying(false) } else { this.selectPlay({ list: this.list, index }) } }, ...mapMutations({ setPlaying: 'SET_PLAYING' }), ...mapActions(['selectPlay']) } } /** * loading状态 * @type {{data(): *, methods: {_hideLoad(): void}}} */ export const loadMixin = { data() { return { mmLoadShow: true // loading状态 } }, methods: { _hideLoad() { let timer clearTimeout(timer) timer = setTimeout(() => { this.mmLoadShow = false }, 200) } } }