vue.js 安装和创建vue.js项目
2017-02-17 本文已影响559人
helinyu


上面的过程有了node、 npm vue_cli webpack
接下来就是创建项目:

ps: 好像上面不管有没有加上webpack,只要之前安装了webpack,默认就是会有一个package.json 的配置文件;

npm install 这个命令会将package.json 这个配置下面的插件重新安装一遍。
npm run dev 运行项目(会自带dev )
http://www.jianshu.com/p/82eaeda8adcf
同样可以查看这个文章


这个时候重新运行还是没有问题,直接切换到全局外网,使用翻墙的软件进行翻墙,切换不同的网络路径进行请求,应该是没有问题。这个是网络问题。

vue 项目的执行流程:(从我们上面创建的“es6”项目讲起)
(1)index.html 只是一个模板,会调用进入src这个库里面,的main.js。

(2)main.js 调入到app.vue里面

看到这里有对应router,就是根据了路由进行加载文件,其中就有template和components这两个文件夹。也就是main.js 包括了路由和资源。template这个就是app.vue 的资源声明;components就是Hello.vue 的资源声明吧。暂时这样理解。
(3)app.vue 这个文件

(4)router/index.js 如何从main.js 到app.vue 的这个页面的呢?其实就是经过路由router这个文件夹

(5)hello.vue 这个才是真实的显示页面
