WebStom使用Ctrl+鼠标滚轮放大或缩小字体
以下是在WebStorm中开发uniapp+vite+ts的步骤:
1.创建一个新的uniapp项目,选择vite作为构建工具。
2.在项目根目录下创建一个vite.config.ts文件,用于配置vite。
3.在vite.config.ts文件中添加以下内容:
```typescript
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': '/src'
}
},
server: {
proxy: {
'/api': {
target: 'http://localhost:3000',
changeOrigin: true,
rewrite: (path) => path.replace(/^/api/, '')
}
}
}
})
```
4.在tsconfig.json文件中添加以下内容:
```json
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"jsx": "preserve",
"sourceMap": true,
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
"exclude": ["node_modules"]
}
```
5.在APP.vue中添加以下内容:
```html
<template>
<router-view></router-view>
</template>
```
6.在main.ts中添加以下内容:
```typescript
import { createApp } from 'vue'
import 'https://blog.csdn.net/Its_sang/article/details/style.css'
import App from 'https://blog.csdn.net/Its_sang/article/details/App.vue'
import store from 'https://blog.csdn.net/Its_sang/article/details/store/index'
import router from 'https://blog.csdn.net/Its_sang/article/details/router/index'
const APP = createApp(App)
APP.use(store)
APP.use(router)
APP.mount('#app')
```