环境:

windows:
vue-cli:
编辑器: vsCode
npm: 6.11. #去nodejs网安装https://npm.taobao.org/mirrors/node/v12.12.0/node-v12.12.0-x64.msi

1.安装 :

>npm install -g @vue/cli
# 查看版本
PS D:\vue\project-> vue -V
@vue/cli 4.0.

2.创建项目:

添加淘宝镜像:
npm install -g cnpm --registry=https://registry.npm.taobao.org
创建项目
vue init webpack my-project
或者
vue create project- #这里可以上下选择, 我们选 手动
Vue CLI v4.0.4
? Please pick a preset:
default (babel, eslint)
> Manually select features # 然后根据自己的需求选组件
Vue CLI v4.0.4
? Please pick a preset: Manually select features
? Check the features needed for your project:
(*) Babel
( ) TypeScript
( ) Progressive Web App (PWA) Support
(*) Router
(*) Vuex
(*) CSS Pre-processors
>(*) Linter / Formatter
( ) Unit Testing
( ) E2E Testing

3.创建路由

3.1 在{项目路径}/src/router/index.js中添加一路由

3.2 在App.vue 中添加 <router-link to="/demo1">Demo1</router-link>

<template>
<div id="app">
<div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link> |
<router-link to="/demo1">Demo1</router-link>
</div>
<router-view/>
</div>
</template> <style lang="less">
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
} #nav {
padding: 30px; a {
font-weight: bold;
color: #2c3e50; &.router-link-exact-active {
color: #42b983;
}
}
}
</style>

3.3 创建 Demo1.vue

<template>
<div class="test">
<h1>This is an Demo1 page</h1> </div> </template> <script>
</script> <style lang=""> </style>

3.4 运行项目

>npm run serve

 DONE  Compiled successfully in 3656ms                                                    ::

  App running at:
- Local: http://localhost:8080/
- Network: http://192.168.1.105:8080/ Note that the development build is not optimized.
To create a production build, run npm run build.

3.5 测试,访问 http://localhost:8080/demo1

最新文章

  1. java关键字extends(继承)、Supe(父类引用空间)、 This(方法调用者对象)、Instanceof(实例类型-判断对象是否属于某个类)、final(最终)、abstract(抽象) 、interface(接口)0
  2. 用c#开发的一款webservice调用小工具,方便测试
  3. &lt;context:component-scan&gt;使用说明
  4. python 脚本
  5. 各种语言HMAC SHA256实现
  6. nginx配置错误
  7. 数字图像处理(MATLAB版)学习笔记(2)——第2章 灰度变换与空间滤波
  8. Ruby中文乱码问题
  9. tomcat是什么?Tomcat 下载、安装、配置图文教程
  10. 傻瓜式搭建私人网络硬盘——owncloud安装指南
  11. [转]浅谈Normalize.css
  12. jquery中innerwidth,outerwidth,outerwidth和width的区别
  13. Android 學習之旅!(2)
  14. jmeter之beanshell取出需要参数,传递给下个请求
  15. 比较两种方式的form请求提交
  16. js基础-运算符
  17. 【转】Java学习---Java的锁和Mysql的锁机制
  18. 问题解决:IDEA右键选择new新文件的时候没有JSP文件选项解决
  19. Life is in the little things --- Spreading wildly on Facebook
  20. 【CS231N】2、多类SVM

热门文章

  1. ASP.NET Core开发者指南(转发)
  2. Java界面程序实现图片的放大缩小
  3. 使用gimp画线、矩形、圆等
  4. DES加密解密工具
  5. 【Web】jquery合并单元格
  6. 06 vue router(一)
  7. php使用装饰模式无侵入式加缓存
  8. 0-1 RSS订阅
  9. 解决pip安装第三方包编码错误:UnicodeDecodeError: &#39;ascii&#39; codec can&#39;t decode byte....
  10. meta viewport移动端自适应