一起创建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.hqwc.cn/news/72194.html

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

相关文章

一次Linux中的木马病毒解决经历(6379端口---newinit.sh)

病毒入侵解决方案 情景 最近几天一直CPU100%,也没有注意看到了以为正常的服务调用,直到腾讯给发了邮件警告说我的服务器正在入侵其他服务器的6379端口,我就是正常的使用不可能去入侵别人的系统的,这是违法的. 排查 既然入侵6379端口,就怀疑是通过我的Redis服务进入的我的系统…

MySQL的安装以及卸载

下载官网 https://www.mysql.com/ 切到下载tab页 找到 MySQL Community Server 或者 MySQL Community (GPL) Downloads --> MySQL Community Server 点击download按钮&#xff1a; 点击download进入下载页面选择No thanks, just start my download就可以开始下载了。 下…

Android3:布局

一。线性布局 创建项目Linear Layout Example activity_main.xml <?xml version"1.0" encoding"utf-8"?><LinearLayout xmlns:android"http://schemas.android.com/apk/res/android"android:layout_width"match_parent"an…

足部IMU在复杂场景中行走定位

随着微机电系统&#xff08;MEMS&#xff09;技术的快速发展&#xff0c;基于MEMS的惯性导航系统&#xff08;INS&#xff09;在任意环境的基站定位方面发挥着至关重要的作用。惯性导航具有自主性强、定位频率高、功耗低、实时性强等特点。因此更适合单兵作战、反恐行动、应急救…

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

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

常用的分布式计算引擎

记录一下&#xff0c;作为备忘。 常用的分布式计算引擎 多表关联的问题&#xff0c;由于NoSQL数据库主要用于海量存储和单表查询&#xff0c;一般都不支持join&#xff0c;需借助更上层的计算框架来实现多表关联&#xff0c;比如: 计算框架支持数据源执行效率Hive本地文件、…

idea常见错误大全之:解决全局搜索失效+搜索条件失效(条件为空)+F8失灵

问题一&#xff1a;全局搜索快捷键ctrlshiftf 突然失灵了&#xff0c;键盘敲烂了 都没反应&#xff0c;这是为什么呢&#xff1f; 肯定不是idea本身的原因&#xff0c;那么就是其它外在因素影响到了idea的快捷键&#xff0c;那么其它的快捷键为什么没失效呢&#xff0c;原因只有…

PHP8的字符串操作2-PHP8知识详解

今日继续分享《php8的字符串操作》昨天一天都没有写多少&#xff0c;内容多&#xff0c;今天继续&#xff1a; 昨天分享的是1、使用trim()、rtrim()和ltrim()函数去除字符串首尾空格和特殊字符。2、使用strlen()函数和mb_strlen()函数获取字符串的长度。 3、截取字符串 PHP对…

SENet网络分析

文章目录 注意力机制&#xff1a;AttentionBiased Competition Theorybottom-up和top-down注意力 SE BlockSqueeze操作Excitation操作scale操作与原结构合并计算复杂度评估 实验与其他网络对比数据集实验内部参数对比实验进一步评估Squeezeexcitation Squuze-and-Excitation网络…

Pytest和Unittest测试框架的区别?

如何区分这两者&#xff0c;很简单unittest作为官方的测试框架&#xff0c;在测试方面更加基础&#xff0c;并且可以再次基础上进行二次开发&#xff0c;同时在用法上格式会更加复杂&#xff1b;而pytest框架作为第三方框架&#xff0c;方便的地方就在于使用更加灵活&#xff0…

vue3动态组件

1 、 可以通过 shallowRef 把 可以把组件进行包裹 <template><div><el-button click"setclick(son1)">1111</el-button><el-button click"setclick(son2)">2222</el-button><el-button click"setclick(son…

shell脚本基础

目录 前言 一、概述 &#xff08;一&#xff09;、shell脚本基础概念 &#xff08;二&#xff09;、shell的类型 二、Shell变量 &#xff08;一&#xff09;、组成 1.变量名 2.变量值 &#xff08;二&#xff09;、类型 1.系统内置变量&#xff08;环境变量&#xff09; 2.自定…