小编mik*_*pr4的帖子

带有参数的 Vuex 映射 Getter - 缓存?

这是一个带有参数化 getter的 Vuex Store 示例,我需要将其映射到 Vue 实例以在模板中使用。

const store = new Vuex.Store({
  state: {
    lower: 5,
    higher: 10,
    unrelated: 3
  },
  getters: {
    inRange: state => value => {
      console.log('inRange run')
      return (state.lower <= value) && (state.higher >= value)
    }
  },
  mutations: {
    reduceLower: state => state.lower--,
    incrementUnrelated: state => state.unrelated++
  }
})

new Vue({
  el: '#app',
  template: "<div>{{ inRange(4) }}, {{ unrelated }}</div>",
  store,
  computed: Object.assign(
    Vuex.mapGetters(['inRange']),
    Vuex.mapState(['unrelated'])
  ),
})

setTimeout(function() {
  console.log('reduceLower')
  store.commit('reduceLower')
  setTimeout(function() {
    console.log('incrementUnrelated') …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vuex vuejs2

8
推荐指数
1
解决办法
8145
查看次数

EclipseLink MOXy @XmlPath支持axis/parent

是否可以接受以下任何XPath表达式?使用eclipselink的2.3.1版

@XmlPath("../header/@type")
@XmlPath("/root/header/@type")
@XmlPath("parent::*/header/@type")
Run Code Online (Sandbox Code Playgroud)

基本上这是在XML文档(/root/tag)中重复的类中,如果不清楚我会详细说明.

我试图遍历树而不是向下.我的其他@XmlPath注释工作正常.

xpath jaxb eclipselink moxy

7
推荐指数
1
解决办法
1184
查看次数

标签 统计

eclipselink ×1

javascript ×1

jaxb ×1

moxy ×1

vue.js ×1

vuejs2 ×1

vuex ×1

xpath ×1