初建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 <[email protected]>
? 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,这个指令可以更改,

猜你喜欢

转载自www.cnblogs.com/lvlvlv/p/11407547.html
今日推荐