How to use the vuex.mapState 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 crawlab-team / crawlab / frontend / src / components / TableView / TaskTableView.vue View on Github external
export default {
  name: 'TaskTableView',
  data () {
    return {
      // setInterval handle
      handle: undefined
    }
  },
  props: {
    title: String
  },
  computed: {
    ...mapState('spider', [
      'spiderForm'
    ]),
    ...mapState('task', [
      'taskList'
    ])
  },
  methods: {
    onClickSpider (row) {
      this.$router.push(`/spiders/${row.spider_id}`)
    },
    onClickNode (row) {
      this.$router.push(`/nodes/${row.node_id}`)
    },
    onClickTask (row) {
      this.$router.push(`/tasks/${row._id}`)
    },
    onRefresh () {
      if (this.$route.path.split('/')[1] === 'spiders') {
        this.$store.dispatch('spider/getTaskList', this.$route.params.id)
github zilpay / zil-pay / src / views / Lock.vue View on Github external
import { mapActions, mapState } from 'vuex'
import btn from '../directives/btn'


export default {
  name: 'LockPage',
  directives: { btn },
  data() {
    return {
      password: '',
      wrongPassword: false,
      storeKey: 'PASSWORD'
    };
  },
  computed: {
    ...mapState('storage', [
      'confirmationTx'
    ]),
  },
  methods: {
    ...mapActions('storage', [
      'unLock'
    ]),
    
    async encryptingAccaunt() {
      const status = await this.unLock(this.password);

      this.wrongPassword = !status;

      if (!this.wrongPassword) {
        if (this.confirmationTx.length > 0) {
          this.$router.push({ name: 'confirmation' });
github tronpay / TronPay-Extension / src / popup / pages / resource / index.vue View on Github external
alertOption: {
        title: '',
        message: this.$i18n.t('alert.pledgeSuccess'),
        type: 'info',
        customIconUrl: '/images/success-icon.png',
        onClose: this.onClose,
        customCloseBtnText: this.$i18n.t('button.close'),
        customCloseBtnClass: 'el-button el-button--primary full-btn'
      }
    }
  },
  computed: {
    ...mapState([
      'currentAccount'
    ]),
    ...mapState('account', [
      'cpu',
      'bandWidth',
      'frozenExpires'
    ]),
    ...mapState('account', {
      tronPower (state) {
        return utils.getTokenAmount(state.tronPower)
      }
    })
  },
  created () {
    this.loadAccount()
  },
  methods: {
    ...mapActions('account', [
      'loadAccount'