-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vuex for better State-Management and Vue-DevTools #40
Comments
Hello @SgtPepper27 For babel: #29 For Vuex:
import Vue from 'vue'
import Vuex from 'vuex'
import * as actions from './actions'
import * as mutations from './mutations'
import * as getters from './getters'
Vue.use(Vuex)
export default new Vuex.Store({
actions,
mutations,
getters
}) Also edit the actions, mutations and getters js files like: https://github.com/vuejs/vuex/tree/dev/examples/shopping-cart/store
// ...
import store from './store'
// ...
new Vue({
// ...
store
// ...
}) and it's ready. If you want to use import { mapActions, mapMutations, mapGetters } from 'vuex' For Vue-devtools: For Android: Have a great day! 😃 |
Gone through the tutorial #29, but still get the error "Unexpected token" => spread syntax still not working. vuex syntax you postet above is not the problem, but the spread syntax "..." ...mapActions([ |
Upgrade your node.js version. Minimum node.js requirement is 6.5.0. You can check with |
I already have version 7.6.0. Example worked for me as nomal vuejs project with template webpack-simple, but on this template i struggle. in my standard vuejs project my .babelrc file looks like that: and that´s it to use spread syntax. |
Spread syntax about ES6, not about this template. Please check one more time: import { mapState, mapActions, mapMutations, mapGetters } from 'vuex' must be added into your file and babel must be configured right. Also it can be about babel preset. es2015 preset description: Also check is your presets installed with npm install --save-dev babel-loader babel-plugin-transform-runtime babel-preset-stage-2 babel-preset-es2015 or for env: npm install --save-dev babel-loader babel-plugin-transform-runtime babel-preset-env So there is so much possibilities, but the template is not inside these possibilities for this error. |
Now it work´s - Thanks. Following settings worked for me: .babelrc: webpack.config.js: { |
in your webpack add the following |
Having some problems with the points in the Header.
Vue-DevTools:
while debugging in chrome, vue-devtools plugin will not detect that i'm working on a vue-project.
Vuex:
After installing "vuex" and "babel-preset-stage-2" i got following error message after import e.g. { mapActions }
ERROR in ./~/vue-loader/lib/selector.js?type=script&index=0!./src/assets/vue/pages/components/add.vue
Module parse failed: C:\phonegap\mytime\node_modules\vue-loader\lib\selector.js?type=script&index=0!C:\phonegap\mytime\src\assets\vue\pages\components\add.vue Unexpected token (34:8)
You may need an appropriate loader to handle this file type.
|
| methods: {
| ...mapActions([ <-- Line 34
| 'addAccount'
| ]),
@ ./src/assets/vue/pages/components/add.vue 3:2-97
@ ./src/routes.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://0.0.0.0:8081 webpack/hot/dev-server ./src/main.js ./webpack/dev_helpers/CordovaDeviceRouter.js
Any suggestions?
Many thanks in advance,
The text was updated successfully, but these errors were encountered: