初建vuex项目
打开黑窗口
# 全局安装 vue-cli
$ npm install -g vue-cli
# 创建一个基于 webpack 模板的新项目
$ vue init webpack my-project
# 这里需要进行一些配置,默认回车即可
This will install Vue 2.x version of the template.
For Vue 1.x use: vue init webpack#1.0 my-project
? Project name my-project
? Project description A Vue.js project
? Author runoob <test@runoob.com>
? Vue build standalone
? Use ESLint to lint your code? Yes
? Pick an ESLint preset Standard
? Setup unit tests with Karma + Mocha? Yes
? Setup e2e tests with Nightwatch? Yes
vue-cli · Generated "my-project".
To get started:
cd my-project
npm install
npm run dev
Documentation can be found at https://vuejs-templates.github.io/webpack
# 运行程序
npm run dev
首次运行时不会自动打开页面会出现一句话 Your application is running here: http://localhost:8080
意思是:你的程序运行地址是:http://localhost:8080
如果需要会默认自动打开浏览器运行
需要在config的index中设置
autoOpenBrowser: true, //是否默认打开浏览器,默认是false,改为true即可
为什么npm run dev 会运行程序呢?
他是需要在package.json中设置的默认是dev,这个指令可以更改,

更新vue的版本:npm install vue --save

浙公网安备 33010602011771号