version "2.0.3"
/
version "2.0.0"
https://github.com/lukepolo/temp
Open public/index
Should see that
store should contain the store object to see the states
Uncaught ReferenceError: store is not defined
Because you import standalone build directly by writing impot Vue from 'vue/dist/vue.js'.
https://github.com/lukepolo/temp/blob/vue-setup/assets/js/app.js#L2
Please see: http://vuejs.org/guide/installation.html#Standalone-vs-Runtime-only-Build
Perfect, thank you.
I hit this issue too. Twice - once with templates and now with Vuex. Why does the documentation always use import Vue from 'vue' when what I'm supposed to do is actually import * as Vue from 'vue/dist/vue.common.js';.
Can you guys either fix the documentation, or just include the whole shebang in the vue npm package and call the other one vue-runtime to avoid conusion? Should I open another ticket for such a request @ktsn?
Please read carefully: https://vuejs.org/v2/guide/installation.html#Standalone-vs-Runtime-only-Build
Unfortunately, we cannot publish different builds because 3rd party plugins may depends on vue package.
@ktsn perhaps consider that for v3 then. Perhaps instead of flipping the meanings you can just drop the vue package and have a vue.common alongside vue.core to be sure people are actively making the decision on what to include.
I've reread and added some clarification to the docs. See https://github.com/vuejs/vuejs.org/pull/663
Thank you.
I'm running into this issue now. Per _Runtime + Compiler vs. Runtime-only_ I'm developing for runtime-only.聽I don't use the 'vue$': 'vue/dist/vue.esm.js' alias or vue-loader.
in your main.js
write these codes
import store from "./store";
Vue.prototype.$store = store;
now, in your components script ... you can access it by
this.$store.state.data
in your
main.js
write these codesimport store from "./store"; Vue.prototype.$store = store;now, in your components script ... you can access it by
this.$store.state.data
This worked for me, but why isn't $store already registered when I'm including the store in he Vue object?
Most helpful comment
I hit this issue too. Twice - once with templates and now with Vuex. Why does the documentation always use
import Vue from 'vue'when what I'm supposed to do is actuallyimport * as Vue from 'vue/dist/vue.common.js';.Can you guys either fix the documentation, or just include the whole shebang in the
vuenpm package and call the other onevue-runtimeto avoid conusion? Should I open another ticket for such a request @ktsn?