本文主要是介绍【vue3.0】安装,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1,安装Vue3:
npm install -g @vue/cli
vue create demo
cd demo
npm run dev //或者yarn dev
2.改造main函数:
const app = createApp(App)
app.mount('#app')
3.安装axios
npm install --save axios在main中:
import axios from 'axios'
app.use(axios)
4.安装element-ui,我使用了全部的样式
npm install element-plus --savemain:
import ElementPlus from 'element-plus'
import 'element-plus/lib/theme-chalk/index.css'
app.use(ElementPlus)
5.安装router
//查看router版本
npm info vue-router versions
//安装某个版本
npm install vue-router@4.0.3
vue add router
import router from './router'
app.use(router)router.js
import {createRouter, createWebHistory} from 'vue-router'
若使用createWebHistory则解析出来的是localhost/test
若使用createWebHashHistory则解析出来的是localhost/#/test
这篇关于【vue3.0】安装的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!