一起创建Vue脚手架吧

目录

  • 一、安装Vue CLI
    • 1.1 配置 npm 淘宝镜像
    • 1.2 全局安装
    • 1.3 验证是否成功
  • 二、创建vue_test项目
    • 2.1 cmd进入桌面
    • 2.2 创建项目
    • 2.3 运行项目
    • 2.4 查看效果
  • 三、脚手架结构分析
    • 3.1 文件目录结构分析
    • 3.2 vscode终端打开项目

一、安装Vue CLI

CLIcommand-line interface 的简写

1.1 配置 npm 淘宝镜像

执行命令:npm config set registry https://registry.npm.taobao.org,然后关闭cmd窗口

C:\Users\nash_>npm config set registry https://registry.npm.taobao.orgC:\Users\nash_>

1.2 全局安装

重新打开新的窗口cmd,然后执行命令:npm install -g @vue/cli,然后再关闭cmd窗口。

C:\Users\nash_>npm install -g @vue/cli
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated apollo-datasource@3.3.2: The `apollo-datasource` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023). See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details.
npm WARN deprecated apollo-server-errors@3.3.1: The `apollo-server-errors` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details.
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated apollo-server-plugin-base@3.7.2: The `apollo-server-plugin-base` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details.
npm WARN deprecated apollo-server-types@3.8.0: The `apollo-server-types` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated apollo-server-express@3.12.0: The `apollo-server-express` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details.
npm WARN deprecated shortid@2.2.16: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated apollo-reporting-protobuf@3.4.0: The `apollo-reporting-protobuf` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023). This package's functionality is now found in the `@apollo/usage-reporting-protobuf` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details.
npm WARN deprecated apollo-server-env@4.2.1: The `apollo-server-env` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023). This package's functionality is now found in the `@apollo/utils.fetcher` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details.
npm WARN deprecated subscriptions-transport-ws@0.11.0: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws    For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md
npm WARN deprecated apollo-server-core@3.12.0: The `apollo-server-core` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details.changed 872 packages in 35s

1.3 验证是否成功

再次重新打开cmd窗口,此时输入vue就不会报错了。

C:\Users\nash_>vue
Usage: vue <command> [options]Options:-V, --version                              output the version number-h, --help                                 display help for commandCommands:create [options] <app-name>                create a new project powered by vue-cli-serviceadd [options] <plugin> [pluginOptions]     install a plugin and invoke its generator in an already created projectinvoke [options] <plugin> [pluginOptions]  invoke the generator of a plugin in an already created projectinspect [options] [paths...]               inspect the webpack config in a project with vue-cli-serviceserve                                      alias of "npm run serve" in the current projectbuild                                      alias of "npm run build" in the current projectui [options]                               start and open the vue-cli uiinit [options] <template> <app-name>       generate a project from a remote template (legacy API, requires@vue/cli-init)config [options] [value]                   inspect and modify the configoutdated [options]                         (experimental) check for outdated vue cli service / pluginsupgrade [options] [plugin-name]            (experimental) upgrade vue cli service / pluginsmigrate [options] [plugin-name]            (experimental) run migrator for an already-installed cli plugininfo                                       print debugging information about your environmenthelp [command]                             display help for commandRun vue <command> --help for detailed usage of given command.C:\Users\nash_>

二、创建vue_test项目

电脑桌面创建vue_test工程。

2.1 cmd进入桌面

打开cmd窗口,输入进入电脑桌面输入命令:cd des,然后按在Tab键,会自动进行代码补全,变成了cd Desktop,然后回车。

Microsoft Windows [版本 10.0.22621.2134]
(c) Microsoft Corporation。保留所有权利。C:\Users\nash_>cd DesktopC:\Users\nash_\Desktop>

2.2 创建项目

输入以下命令:vue create vue_test回车,然后选择Vue2回车.

C:\Users\nash_>cd DesktopC:\Users\nash_\Desktop>vue create vue_testVue CLI v5.0.8
? Please pick a preset:Default ([Vue 3] babel, eslint)
> Default ([Vue 2] babel, eslint)Manually select features

之后,提示安装成功,并告诉你进入到目录cd vue_test,然后执行命令npm run serve。此时关闭cmd窗口。

Vue CLI v5.0.8
✨  Creating project in C:\Users\nash_\Desktop\vue_test.
⚙️  Installing CLI plugins. This might take a while...added 861 packages in 3m
🚀  Invoking generators...
📦  Installing additional dependencies...added 92 packages in 2m
⚓  Running completion hooks...📄  Generating README.md...🎉  Successfully created project vue_test.
👉  Get started with the following commands:$ cd vue_test$ npm run serveC:\Users\nash_\Desktop>

2.3 运行项目

重新打开cmd,进入到目录vue_test,执行命令npm run serve,按住两遍ctrl+c可以停止终端运行。

 DONE  Compiled successfully in 4573ms                                                                          14:05:58App running at:- Local:   http://localhost:8080/- Network: http://192.168.2.9:8080/Note that the development build is not optimized.To create a production build, run npm run build.

2.4 查看效果

打开浏览器输入网址:http://localhost:8080/

在这里插入图片描述

三、脚手架结构分析

3.1 文件目录结构分析

  1. 通过VSCode打开vue_test工程

在这里插入图片描述

  1. 所展示的目录结构如下

在这里插入图片描述

  1. 具体文件说明
  |—— node_modules |—— public|   |—— favicon.ico:页签图标|   |—— index.html:主页面|—— src|   |—— assets:存放静态资源|       |—— logo.png|   |—— component:存放组件|       |—— HelloWorld.vue|   |—— App.vue:汇总所有组件|   |—— main.js:入口文件|—— .gitignore: git版本管制忽略的配置|—— babel.config.js: babel的配置文件,将ES6——> ES5  |—— package.json: 应用包配置文件|—— README.md:应用描述文件|—— package-lock.json:包版本控制文件

3.2 vscode终端打开项目

  1. vscode打开终端 :输入:npm run serve

在这里插入图片描述

  1. 同样,按下两遍ctrl+c停掉终端.
    在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/42752.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

日常BUG——微信小程序提交代码报错

&#x1f61c;作 者&#xff1a;是江迪呀✒️本文关键词&#xff1a;日常BUG、BUG、问题分析☀️每日 一言 &#xff1a;存在错误说明你在进步&#xff01; 一、问题描述 在使用微信小程序开发工具进行提交代码时&#xff0c;报出如下错误&#xff1a; Invalid a…

Git提交规范指南

在开发过程中&#xff0c;Git每次提交代码&#xff0c;都需要写Commit message&#xff08;提交说明&#xff09;&#xff0c;规范的Commit message有很多好处&#xff1a; 方便快速浏览查找&#xff0c;回溯之前的工作内容可以直接从commit 生成Change log(发布时用于说明版本…

5、flink任务中可以使用哪些转换算子(Transformation)

1、什么是Flink中的转换算子 在使用 Flink DataStream API 开发流式计算任务时&#xff0c;可以将一个或多个 DataStream 转换成新的 DataStream&#xff0c;在应用程序中可以将多个数据转换算子合并成一个复杂的数据流拓扑图。 2、常用的转换算子 Flink提供了功能各异的转换算…

[论文笔记]ON LAYER NORMALIZATION IN THE TRANSFORMER ARCHITECTURE

引言 这是论文ON LAYER NORMALIZATION IN THE TRANSFORMER ARCHITECTURE的阅读笔记。本篇论文提出了通过Pre-LN的方式可以省掉Warm-up环节,并且可以加快Transformer的训练速度。 通常训练Transformer需要一个仔细设计的学习率warm-up(预热)阶段:在训练开始阶段学习率需要设…

JDK 1.6与JDK 1.8的区别

ArrayList使用默认的构造方式实例 jdk1.6默认初始值为10jdk1.8为0,第一次放入值才初始化&#xff0c;属于懒加载 Hashmap底层 jdk1.6与jdk1.8都是数组链表 jdk1.8是链表超过8时&#xff0c;自动转为红黑树 静态方式不同 jdk1.6是先初始化static后执行main方法。 jdk1.8是懒加…

设置PHP的fpm的系统性能参数pm.max_children

1 介绍 PHP从Apache module换成了Fpm&#xff0c;跑了几天突然发现网站打不开了。 页面显示超时&#xff0c;检查MySQL、Redis一众服务都正常。 进入Fpm容器查看日志&#xff0c;发现了如下的错误信息&#xff1a; server reached pm.max_children setting (5), consider r…

python中的svm:介绍和基本使用方法

python中的svm&#xff1a;介绍和基本使用方法 支持向量机&#xff08;Support Vector Machine&#xff0c;简称SVM&#xff09;是一种常用的分类算法&#xff0c;可以用于解决分类和回归问题。SVM通过构建一个超平面&#xff0c;将不同类别的数据分隔开&#xff0c;使得正负样…

2023全国大学生数学建模竞赛A题B题C题D题E题思路+模型+代码+论文

目录 一. 2023国赛数学建模思路&#xff1a; 赛题发布后会第一时间发布选题建议&#xff0c;思路&#xff0c;模型代码等 详细思路获取见文末名片&#xff0c;9.7号第一时间更新 二.国赛常用的模型算法&#xff1a; 三、算法简介 四.超重要&#xff01;&#xff01;&…

msvcp140.dll丢失的解决方法,如何预防msvcp140.dll丢失

在电脑操作系统中经常会弹出类似msvcp140.dll丢失的错误提示窗口&#xff0c;导致软件无法正常运行。为什么会出现msvcp140.dll丢失的情况呢&#xff1f;出现这种情况应该如何解决呢&#xff1f;小编有三种解决方法分享给大家。 一.msvcp140.dll丢失的原因 1.安装过程中受损:在…

前端框架学习-ES6新特性(尚硅谷web笔记)

ECMASript是由 Ecma 国际通过 ECMA-262 标准化的脚本程序设计语言。javaScript也是该规范的一种实现。 新特性目录 笔记出处&#xff1a;b站ES6let 关键字const关键字变量的解构赋值模板字符串简化对象写法箭头函数rest参数spread扩展运算符Promise模块化 ES8async 和 await E…

云原生周刊:Kubernetes v1.28 新特性一览 | 2023.8.14

推荐一个 GitHub 仓库&#xff1a;Fast-Kubernetes。 Fast-Kubernetes 是一个涵盖了 Kubernetes 的实验室&#xff08;LABs&#xff09;的仓库。它提供了关于 Kubernetes 的各种主题和组件的详细内容&#xff0c;包括 Kubectl、Pod、Deployment、Service、ConfigMap、Volume、…

CF1013B And 题解

题目传送门 题目意思&#xff1a; 给你一个长度为 n n n 的序列 a i a_i ai​&#xff0c;再给一个数 x x x。每一步你可以将序列中的一个数与上 x x x。请问最少要多少步才可以使得序列中出现两个相同的数&#xff0c;如果无解输出 − 1 -1 −1。 思路&#xff1a; 首…

Vue页面刷新常用的4种方法

Vue项目里,有时候我们需要刷新页面,重新加载页面数据,常用方法如下: 方法一:location.reload() 方法全局刷新 使用 location.reload() 方法可以简单地实现当前页面的刷新,这个方法会重新加载当前页面,类似于用户点击浏览器的刷新按钮。 在 Vue 中,可以将该方法绑定到…

题解 | #M.Fair Equation# 2023牛客暑期多校10

M.Fair Equation 签到题 题目大意 给定一个式子 A B C ABC ABC &#xff0c;其中正整数 A , B , C ≤ 1 0 6 A,B,C\le 10^6 A,B,C≤106 问能否在 A , B , C A,B,C A,B,C 其中一个数的某一位置&#xff08;可以是开头和结尾&#xff09;插入一个数字&#xff0c;使得等式…

Elasticsearch 查询之Function Score Query

前言 ES 的主查询评分模式分为两种&#xff0c;是信息检索领域的重要算法&#xff1a; TF-IDF 算法 和 BM25 算法。 Elasticsearch 从版本 5.0 开始引入了 BM25 算法作为默认的文档评分&#xff08;relevance scoring&#xff09;算法。在此之前&#xff0c;Elasticsearch 使…

sip网络号角喇叭 sip音柱 POE供电广播音箱 ip网络防水对讲终端 sip网络功放

SV-7042TP网络号角喇叭 一、描述 SV-7042TP是我司的一款SIP网络号角喇叭&#xff0c;具有10/100M以太网接口&#xff0c;内置有一个高品质扬声器&#xff0c;将网络音源通过自带的功放和喇叭输出播放&#xff0c;可达到功率30W。SV-7042TP作为SIP系统的播放终端&#xff0c;可…

【脚踢数据结构】常见树总结(图码结和版)

(꒪ꇴ꒪ )&#xff0c;Hello我是祐言QAQ我的博客主页&#xff1a;C/C语言&#xff0c;Linux基础&#xff0c;ARM开发板&#xff0c;软件配置等领域博主&#x1f30d;快上&#x1f698;&#xff0c;一起学习&#xff0c;让我们成为一个强大的攻城狮&#xff01;送给自己和读者的…

如何构造不包含字母和数字的webshell

利用不含字母与数字进行绕过 1.异或进行绕过 2.取反进行绕过 3.利用php语法绕过 利用不含字母与数字进行绕过 基本代码运行思路理解 <?php echo "A"^""; ?> 运行结果为! 我们可以看到&#xff0c;输出的结果是字符"!"。之所以会…

C++:字符串哈希

字符串哈希 给定一个长度为 n n n的字符串&#xff0c;再给定 m m m个询问&#xff0c;每个询问包含四个整数 l 1 , r 1 , l 2 , r 2 l_1,r_1,l_2,r_2 l1​,r1​,l2​,r2​&#xff0c;请你判断 [ l 1 , r 1 ] [l_1,r_1] [l1​,r1​]和 [ l 2 , r 2 ] [l_2,r_2] [l2​,r2​]这…

“深入理解Java虚拟机(JVM):背后的工作原理解析“

标题&#xff1a;深入理解Java虚拟机&#xff08;JVM&#xff09;&#xff1a;背后的工作原理解析 摘要&#xff1a;本文将深入探讨Java虚拟机&#xff08;JVM&#xff09;的工作原理&#xff0c;包括内存管理、垃圾回收、即时编译器等关键概念&#xff0c;以及如何优化代码以…