|
|
1 týždeň pred | |
|---|---|---|
| .vscode | 1 mesiac pred | |
| public | 1 mesiac pred | |
| src | 1 týždeň pred | |
| .gitignore | 1 mesiac pred | |
| README.md | 1 mesiac pred | |
| index.html | 1 mesiac pred | |
| orval.config.ts | 1 týždeň pred | |
| package-lock.json | 1 týždeň pred | |
| package.json | 1 týždeň pred | |
| tsconfig.app.json | 1 týždeň pred | |
| tsconfig.json | 1 mesiac pred | |
| tsconfig.node.json | 1 mesiac pred | |
| vite.config.ts | 1 týždeň pred |
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 <script setup> SFCs, check out the script setup docs to learn more.
Learn more about the recommended Project Setup and IDE Support in the Vue Docs TypeScript Guide.
node18
Vue 3 + TypeScript + Vite6
项目初始化
npm create vite@6
添加vue-router和elementPlus依赖
安装
npm install vue-router@4
npm install element-plus --save
配置
const routes:RouteRecordRaw[] = [
{
path: '/',
name: 'commonLayout',
component: CommonLayout,
children: [
{
path: '/',
name: 'home',
component: HomeView
},
{
path: '/about',
name: 'about',
component: AboutView
},
],
},
]
const router : Router = createRouter({
history: createWebHistory(),
routes: routes,
});
export default router
使用
app.use(router)
app.use(ElementPlus)
添加状态管理依赖
安装
npm install pinia
配置
使用
import { createPinia } from 'pinia'
const pinia = createPinia()
app.use(pinia)
添加axios依赖
openAPI自动生成接口调用