javascript - How to use the state obtained by ...mapGetters and ...mapState to operate in methods?
阿神
阿神 2017-05-31 10:40:20
0
3
786

Can it only be displayed on the page? I know that I can use this.$store.state to obtain these states for operation

阿神
阿神

闭关修行中......

reply all(3)
巴扎黑
 ...mapState({
        a: function (state) {
          return state.A
        },
        b: function (state) {
          return state.b
        }
      })

Just access this.a this.b directly in other methods

滿天的星座

For example, ...mapState(['changePrePosition'])Just use this.changePrePosition()

仅有的幸福
...mapState(['value'])

Use this.value to get the value, but modifying the value of state requires mutations

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template