How to use the vuex.mapGetters function in vuex

To help you get started, we’ve selected a few vuex examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kitware / simput / src / components / core / ControlsDrawer / script.js View on Github external
import { mapGetters } from 'vuex';
import { Getters } from 'simput/src/stores/types';

import GlobalSettings from 'simput/src/components/core/GlobalSettings';
import WorkflowMenu from 'simput/src/components/core/WorkflowMenu';

// ----------------------------------------------------------------------------

export default {
  name: 'ControlsDrawer',
  components: {
    GlobalSettings,
    WorkflowMenu,
  },
  computed: Object.assign(
    mapGetters({
      dataModel: Getters.SIMPUT_MODEL,
    })
  ),
  data() {
    return {
      activeTab: 0,
    };
  },
};
github paulschwoerer / leafplayer / frontend / src / components / sidebar / Player / Player.vue View on Github external
},

        watch: {
            // update Howler volume on volume change
            volume(value) {
                Howler.volume(value);
            },

            // update Howler muted state on mute change
            muted(value) {
                Howler.mute(value);
            },
        },

        computed: {
            ...mapGetters(PlayerNamespace, {
                isPaused: 'isPaused',
                isPlaying: 'isPlaying',
                isStopped: 'isStopped',
                isLoading: 'isLoading',
                queueSize: 'queueSize',
                currentSong: 'currentSong',
            }),

            ...mapState({
                apiToken: state => state.auth.token,
                apiUrl: state => state.config.api.base,
            }),

            ...mapState(PlayerNamespace, {
                mode: state => state.mode,
                queue: state => state.queue,
github doccano / doccano / frontend / pages / projects / _id / statistics / index.vue View on Github external
import { mapActions, mapGetters, mapState } from 'vuex'
import DoughnutChart from '@/components/molecules/DoughnutChart'
import BarChart from '@/components/molecules/BarChart'

export default {
  layout: 'project',

  middleware: ['check-auth', 'auth', 'check-admin'],

  components: {
    DoughnutChart,
    BarChart
  },

  computed: {
    ...mapGetters('statistics', ['userStats', 'labelStats', 'progress']),
    ...mapState('statistics', ['stats'])
  },

  async created() {
    await this.fetchStatistics({
      projectId: this.$route.params.id
    })
  },

  methods: {
    ...mapActions('statistics', ['fetchStatistics'])
  },

  validate({ params }) {
    return /^\d+$/.test(params.id)
  }
github dennisreimann / uiengine / packages / ui / src / vue / components / MainTokens.vue View on Github external
ContentTag
  },

  mixins: [
    Iframe
  ],

  props: {
    id: {
      type: String,
      required: true
    }
  },

  computed: {
    ...mapGetters('state', ['config', 'pages']),
    ...mapGetters('preferences', ['currentTheme']),

    page () {
      return this.pages[this.id]
    },

    iframeSrc () {
      return `${window.UIengine.base}_tokens/${this.currentTheme.id}/${this.page.id}.html`
    }
  },

  mounted () {
    this.mountResizableIframe(this.$refs.iframe)
  },

  beforeDestroy () {
github Tencent / bk-cmdb / src / ui / src / components / model-instance / mixin-auth.js View on Github external
import { mapGetters } from 'vuex'

export default {
    computed: {
        ...mapGetters('objectModelClassify', ['models', 'getModelById']),
        INST_AUTH () {
            const params = this.$route.params
            const bizId = params.bizId
            const instId = params.instId
            return {
                U_BUSINESS: {
                    type: this.$OPERATION.U_BUSINESS,
                    relation: [parseInt(bizId)]
                },
                U_INST: {
                    type: this.$OPERATION.U_INST,
                    relation: [(this.getModelById(params.objId) || {}).id, parseInt(instId)]
                }
            }
        }
    }
github doccano / doccano / frontend / components / containers / annotation / GuidelineButton.vue View on Github external
import GuidelineCard from '@/components/organisms/annotation/GuidelineCard'

export default {
  components: {
    BaseDialog,
    GuidelineCard
  },

  data() {
    return {
      dialog: false
    }
  },

  computed: {
    ...mapGetters('projects', ['currentProject'])
  },

  created() {
    this.setCurrentProject(this.$route.params.id)
  },

  methods: {
    ...mapActions('projects', ['setCurrentProject'])
  }
}
github learningequality / studio / contentcuration / contentcuration / static / js / edit_channel / channel_set / views / ChannelSelectList.vue View on Github external
type: String,
      required: true,
    },
  },
  data() {
    return {
      isExpanded: false,
      channels: [],
      isLoading: false,
    }
  },
  components: {
    ChannelItem,
  },
  computed: Object.assign(
    mapGetters('channel_set', [
      'allChannels'
    ]),
    {

      translateName() {
        return this.$tr(this.listName);
      },
      idName() {
        return "#" + this.listName;
      },
      togglerClass() {
        return (this.isExpanded)? 'arrow_drop_down': 'arrow_drop_up';
      },
    }
  ),
  methods: Object.assign(