1.VUE3官網(wǎng)
https://cn.vuejs.org/
2.通過Vite創(chuàng)建項目
全局安裝vite
npm config set registry=https://registry.npmmirror.com 使用國內(nèi)源
npm install -g vite@latest
安裝vite前要先查看鏡像源地址并使用國內(nèi)鏡像源地址
//查看鏡像源地址
npm config get registry
//更換國內(nèi)鏡像源地址
npm config set registry=https://registry.npmmirror.com
VUE3官網(wǎng)
2.1查看npm版本 (非必要)
npm --version
8.15.0
2.2npm更新版本 (非必要)
$ npm install -g npm
3.創(chuàng)建項目
npm init vite@latest vue3demo -- --template vue-ts
4.vscode打開項目
文章來源:http://www.zghlxwxcb.cn/news/detail-835965.html
4.1運行命令
npm install
npm run dev
5.總結(jié)->整體運行步驟:
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.生命周期鉤子函數(shù)
https://cn.vuejs.org/api/composition-api-lifecycle.html#onmounted文章來源地址http://www.zghlxwxcb.cn/news/detail-835965.html
到了這里,關(guān)于初識VUE3的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!