This website is based on the upcoming changes of the elabs Rails engine. Everything's not fine, but you can see the changes coming in the next releases.

Following VueX Modulator - Part 1: generating VueX modules (en)

I tested the "modulator" on a Nativescript-vue application and it works well. Use it like this:

// app/store.js

import Vue from 'nativescript-vue'
import Vuex from 'vuex'

import Modulator from './modulator'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {},
  modules: {
    users: Modulator.generateModule('users', 'user', 'users', false, false),
  },
})

After testing Vuex(3.0.1) in a Nativescript-vue (2.0) app I noticed that when using ModalViews or ListViews, $store is not available in the list items components or modal component. For now, use a StackLayout for lists and I pass the $store as a prop to the ModalView:

<!-- Instead of a ListView -->
<StackLayout class="list-group">
  <MyComponent v-for="item in items" :item="item" :key="item.id" class="list-group-item"/>
</StackLayout>

In MyComponent, the method to open the modal is like:

import ItemForm from '../forms/ItemForm'

export default {
  name: 'MyComponent',
  props: {
    item: { required: true, type: Object },
  },
  methods: {
    openForm () {
      const props = {item: this.item, store: this.$store} // props for ItemForm
      this.$showModal(ItemForm, { props })                // Show ItemForm as a ModalView
    },
  },
}