第16集丨一起创建Vue脚手架吧

news2024/9/23 17:22:40

目录

  • 一、安装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.org

C:\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 command

Commands:
  create [options] <app-name>                create a new project powered by vue-cli-service
  add [options] <plugin> [pluginOptions]     install a plugin and invoke its generator in an already created project
  invoke [options] <plugin> [pluginOptions]  invoke the generator of a plugin in an already created project
  inspect [options] [paths...]               inspect the webpack config in a project with vue-cli-service
  serve                                      alias of "npm run serve" in the current project
  build                                      alias of "npm run build" in the current project
  ui [options]                               start and open the vue-cli ui
  init [options] <template> <app-name>       generate a project from a remote template (legacy API, requires
                                             @vue/cli-init)
  config [options] [value]                   inspect and modify the config
  outdated [options]                         (experimental) check for outdated vue cli service / plugins
  upgrade [options] [plugin-name]            (experimental) upgrade vue cli service / plugins
  migrate [options] [plugin-name]            (experimental) run migrator for an already-installed cli plugin
  info                                       print debugging information about your environment
  help [command]                             display help for command

  Run 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 Desktop

C:\Users\nash_\Desktop>

2.2 创建项目

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

C:\Users\nash_>cd Desktop

C:\Users\nash_\Desktop>vue create vue_test

Vue 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 serve


C:\Users\nash_\Desktop>

2.3 运行项目

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

 DONE  Compiled successfully in 4573ms                                                                          14:05:58

  App 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.coloradmin.cn/o/901041.html

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

相关文章

re学习(33)攻防世界-secret-galaxy-300(脑洞题)

下载压缩包&#xff1a; 下载链接&#xff1a;https://adworld.xctf.org.cn/challenges/list 参考文章&#xff1a;攻防世界逆向高手题之secret-galaxy-300_沐一 林的博客-CSDN博客 发现这只是三个同一类型文件的三个不同版本而已&#xff0c;一个windows32位exe&#xff0…

VBA技术资料MF45:VBA_在Excel中自定义行高

【分享成果&#xff0c;随喜正能量】可以不光芒万丈&#xff0c;但不要停止发光。有的人陷入困境&#xff0c;不是被人所困&#xff0c;而是自己束缚自己&#xff0c;这时"解铃还须系铃人"&#xff0c;如果自己无法放下&#xff0c;如何能脱困&#xff1f; 。 我给V…

【C++】C++ 语言对 C 语言的加强 ③ ( 类型检查增强 - 所有函数和变量必须有类型 | 新增 bool 类型 - bool 类型简介 )

文章目录 一、类型检查增强 - 所有函数和变量必须有类型1、C 语言函数类型 - 函数参数与返回值类型可以不确定2、C 语言函数类型 - 函数参数与返回值类型必须写明 二、新增 bool 类型 - bool 类型简介 一、类型检查增强 - 所有函数和变量必须有类型 1、C 语言函数类型 - 函数参…

arduino Xiao ESP32C3 oled0.96 下雪花

Xiao ESP32C3使用oled 0.96实现下雪的功能 雪花下落的时候, 随机生成半径和位置 sandR和sandX,sandY 保存雪花下落位置的时候, 将其周边一圈设置为-1, 标记为有雪花 其他雪花下落的时候, 其他雪花的一圈如果遇到-1, 则停止下落, 并重复2 #include "oled.h" void …

Java反射机制 (秒懂百科)

一、什么是反射&#xff1f; 反射允许对成员变量&#xff0c;成员方法和构造方法的信息进行编程访问。。 反射是一种机制。对于任何一个类&#xff0c;都能知道这个类的所有属性和方法。对于任何一个对象&#xff0c;都能调用这个对象的所有属性和方法。这种动态获取类的信息和…

【推荐】深入浅出bean的生命周期

目录 1.spring 管理JavaBean的过程&#xff08;生命周期&#xff09; 2.spring的JavaBean管理中单例模式及原型&#xff08;多例&#xff09;模式 2.1 . 默认为单例&#xff0c;但是可以配置多例 2.2.举例论证 2.2.1 默认单例 2.2.2 设置多例 2.2.3单例与多例的初始化的时…

记录win 7旗舰版 “VMware Alias Manager and Ticket Service‘(VGAuhService)启动失败。

记录win 7旗舰版 "VMware Alias Manager and Ticket Service’(VGAuhService)启动失败。 描述如图 https://learn.microsoft.com/zh-CN/cpp/windows/latest-supported-vc-redist?viewmsvc-140#visual-studio-2015-2017-2019-and-2022 安装对应版本的VC 库就可以解决问…

重磅Redis 7 发布,有哪些新特性?

Redis 7.2.0 现已发布&#xff0c;这是首个 Unified Redis Release。此版本包含一系列广泛的新功能&#xff0c;以及对人工智能计划功能支持的重大投资。 公告称&#xff0c;这是 “影响最深远的版本。在每一项增强功能中&#xff0c;你都能感受到一个强烈的主题&#xff1a;让…

idea使用docker生成镜像(打包镜像,导入镜像,导出镜像)

1&#xff1a;先下载安装dockerdesktop&#xff0c;安装成功后 2&#xff1a; 在cmd执行docker -v&#xff0c;查看安装的docker版本 C:\Users\dell>docker -v Docker version 24.0.5, build ced09963&#xff1a;需要启动 dockerdesktop应用&#xff0c;才算启动docker&a…

k8s基本概念、k8s对象、三个命令玩转所有的yaml写法、给vscode安装插件、kubectl和kubelet及自动补全

文章目录 1、K8S基本概念2、kubernetes Objects&#xff08;k8s对象&#xff09;2.1、定义2.2、对象的spec和status2.3、如何写任意资源的yaml&#xff08;以Pod为例&#xff09;2.4、pod的yaml文件2.5、k8s对象yaml的结构2.6、管理k8s对象2.7、对象名称2.8、名称空间2.9、标签…

Leetcode 0814周总结

本周刷题&#xff1a; 88, 108, 121, 219, 228, 268, 283, 303, 349, 350, 414, 448 88 合并两个有序数组 nums1{1, 2, 3 ,0, 0, 0} nums2{2, 5, 6} 合成效果&#xff1a;nums1{1, 2, 2, 3, 5, 6} 思路&#xff1a;【双指针】对两个数组设置双指针&#xff0c;依次比较哪…

transform模型讲解

目录 game是游戏 与北京在一起&#xff1a;冬奥会 transform &#xff1a;encode&#xff0c;decode 12步骤 自注意力机制就是变形金刚的拆解对照&#xff1a;生成零部件V和权重K&#xff0c;前馈神经网络进行权重调节&#xff1a;初步变形 编码器Attention就是考虑上下文信…

Spring学习笔记+SpringMvc+SpringBoot学习笔记

壹、核心概念&#xff1a; 1.1. IOC和DI IOC&#xff08;Inversion of Control&#xff09;控制反转&#xff1a;对象的创建控制权由程序转移到外部&#xff0c;这种思想称为控制反转。/使用对象时&#xff0c;由主动new产生对象转换为由外部提供对象&#xff0c;此过程种对象…

阿里云服务器扩容数据盘/系统盘小记

参考&#xff1a;扩容分区和文件系统&#xff08;Linux&#xff09; 阿里云的教程写的倒是详细&#xff0c;就是太细节&#xff0c;不利于阅读。 1 确认分区数据盘的属性 运行以下命令&#xff0c;确认待扩容云盘及其分区信息。 fdisk -lu设备&#xff1a; ①&#xff1a;云…

线性筛选素数

线性筛选素数 问题 求取范围[2,n] 之间的所有素数 方法一 方法一概述 使用数字prime[i]来标记i是否为素数。初始化prime[2…n]1。 当处理到数字i时&#xff0c;若prime[i]0&#xff0c;则代表2到i-1中有i的因子&#xff0c;因此i为合数&#xff1b;若prime[i]1&#xff0c…

美团——城市低空物流无人机的设计挑战与应对

城市低空物流无人机的设计挑战与应对 强度分析 振动影响 动力设计 噪声设计 冗余备份更加性价比&#xff0c;便宜好实现 航电系统 动力系统的冗余 电池系统的冗余 通讯系统等冗余 降落冗余 安全降落 计算高效 产线标定 底层基础库 离线系统 行业公开测评 未来展望 – 导航定…

C运行时错误——error realloc(): invalid next size

在LeetCode做题时遇到一个运行时错误&#xff0c;将引起问题的原因记录一下备忘&#xff1a; 我们在malloc或calloc等API分配内存时&#xff0c;libc库除了分配给我们在参数中设定大小的内存&#xff08;可能会有内存对齐&#xff0c;实际分配的比参数设定的要多&#xff09;&…

LeetCode算法递归类—二叉树中的最大路径和

目录 124. 二叉树中的最大路径和 - 力扣&#xff08;LeetCode&#xff09; 题解&#xff1a; 代码&#xff1a; 运行结果&#xff1a; 二叉树中的 路径 被定义为一条节点序列&#xff0c;序列中每对相邻节点之间都存在一条边。同一个节点在一条路径序列中 至多出现一次 。该…

STM32驱动OLED显示菜单功能(附带oled硬件iic驱动代码)

while循环里面就写菜单退出 菜单进入 static int flag1; //记录你的选择//if(return_FLAG1)return_FLAG0;OLED_GotoXY(10,0);OLED_Puts("1 LED_TEST",&Font_11x18,1);OLED_GotoXY(10,20);OLED_Puts("2 USART_TEST",&Font_11x18,1);OLED_GotoXY…