Legal stuff about this site and your private life:

  • We use a cookie to keep your preferences (language, NSFW status, login status) during navigation.
  • We use your local storage to save the announces you closed (like this one).
  • We don't save informations you don't give
  • We don't share your email address if you comment or register
  • There is no tracker of any kind.

If you're not OK with this, move your way.

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
    },
  },
}

Leave a comment

You want to react to this content or ask something to the author? Just leave a comment here!

Note that the comments are not publicly visible, so don't worry if you don't see yours.

All the information you give will only be visible to the author. We don't share anything with anyone.

Don't fill this field if you want this form to be saved.