Skip to content
This repository was archived by the owner on Dec 5, 2022. It is now read-only.

Vuex is not installed when the user selects "Install vuex? (state management) Yes" #118

Closed
msaelices opened this issue Dec 11, 2018 · 4 comments

Comments

@msaelices
Copy link
Contributor

Version

N/A

Reproduction link

https://nativescript-vue.org/en/docs/getting-started/quick-start/

Platform and OS info

All platforms

Steps to reproduce

vue init nativescript-vue/vue-cli-template testapp

Select "Yes" in the "Install vuex? (state management)" question.

What is expected?

Install and use vuex

What is actually happening?

The app is exactly the same as if we answer no to the vuex question.

@ghost
Copy link

ghost commented Jan 11, 2019

I usually do this manually:

$ mkdir ./app/store
$ touch ./app/store/index.js

Then in the created file you can start with the following code.

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

Vue.use(Vuex)

const store = new Vuex.Store({
  //
})

Vue.prototype.$store = store;

export default store;

Finally you can do this in your app-main.js.

import Vue from 'nativescript-vue'
import Store from '@/store'

// Main component
import Main from '@/components/Main'

// Prints Vue logs when --env.production is *NOT* set while building
Vue.config.silent = (TNS_ENV === 'production')

const vm = new Vue({
  render: h => h('frame', [h(Main)]),
  store: Store
}).$start()

@rahimnathwani
Copy link

@msaelices it looks like you fixed this issue in #124

Is that right, or is @gregorip02's suggestion preferred (making a store folder instead of a single file store.js)?

@nativescript-vue-bot
Copy link
Collaborator

We are locking this issue because it has been closed for more than 14 days.

If the issue comes up again please open a new issue with additional details.

@nativescript-vue nativescript-vue locked as resolved and limited conversation to collaborators Sep 8, 2019
@msaelices
Copy link
Contributor Author

@rahimnathwani yes I did it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

4 participants