vue入门例子(一)
介绍了vue脚手架的hello-world例子
效果图
下载安装 nodeJs
下载安装后,在cmd运行如下命令,说明安装正常
$ node -v
v10.16.0
$ npm -v
6.9.0
设置npm下载镜像,提高下载速度
$ npm config set registry https://registry.npm.taobao.org
查询一下,确保成功
$ npm config get registry
https://registry.npm.taobao.org/
安装vue环境
安装vue
$ npm install vue
安装vue脚手架,用于快速搭建环境,-g 代表全局安装
$ npm install -g @vue/cli
确保安装成功
$ npm view vue version
2.6.10
$ vue -V
3.8.4
创建hello-world
执行创建语句,会在当前路径生成hello-world文件夹
$ vue create hello-world
进入项目路径
$ cd hello-world
通过npm下载库
$ npm install
运行后,访问 localhost:8080 可以看到hello-word页面
$ npm run serve
可以打包资源到dist文件下
$ npm run build