初识VUE3

1.VUE3官网

https://cn.vuejs.org/

2.通过Vite创建项目

全局安装vite

npm config set registry=https://registry.npmmirror.com 使用国内源

npm  install -g  vite@latest

安装vite前要先查看镜像源地址并使用国内镜像源地址

//查看镜像源地址
npm config get registry
//更换国内镜像源地址
npm config set registry=https://registry.npmmirror.com

VUE3官网

2.1查看npm版本 (非必要)

npm --version
8.15.0

2.2npm更新版本 (非必要)

$ npm install -g npm

3.创建项目

npm init vite@latest vue3demo -- --template vue-ts

4.vscode打开项目

4.1运行命令

npm install
npm run dev

5.总结->整体运行步骤:

1. npm  install -g  vite@latest
2. npm init vite@latest 项目名称 -- --template vue-ts
3. cd 到项目目录之后运行: 
4. npm  install  
5. npm  run  dev

6.使用组件

<template>
  <MyComponent />
</template>

<script setup>
   import MyComponent from './MyComponent.vue'
</script>

7.生命周期钩子函数

https://cn.vuejs.org/api/composition-api-lifecycle.html#onmounted

相关推荐

  1. vue 3.0

    2024-02-22 06:28:02       50 阅读
  2. <span style='color:red;'>初</span><span style='color:red;'>识</span><span style='color:red;'>VUE</span>

    VUE

    2024-02-22 06:28:02      60 阅读
  3. C++(3)

    2024-02-22 06:28:02       54 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-02-22 06:28:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-02-22 06:28:02       100 阅读
  3. 在Django里面运行非项目文件

    2024-02-22 06:28:02       82 阅读
  4. Python语言-面向对象

    2024-02-22 06:28:02       91 阅读

热门阅读

  1. HTML5 扩展了 HTMLDocument 类型

    2024-02-22 06:28:02       42 阅读
  2. css3实现无缝滚动,鼠标经过暂停

    2024-02-22 06:28:02       50 阅读
  3. Opencv3.2 ubuntu20.04安装过程

    2024-02-22 06:28:02       54 阅读
  4. B3623枚举排列

    2024-02-22 06:28:02       51 阅读
  5. 构建一个动态数据可视化仪表板

    2024-02-22 06:28:02       50 阅读