更新i18n相关,vite配置文件

This commit is contained in:
Bunny 2024-05-27 00:03:12 +08:00
parent 1ce3308740
commit bf9ff0206e
13 changed files with 981 additions and 1030 deletions

View File

@ -13,7 +13,3 @@ VITE_DROP_CONSOLE = true
# 开发环境接口地址
VITE_API_URL = /api
# 开发环境跨域代理,可配置多个
VITE_PROXY = [["/api","https://mock.mengxuegu.com/mock/64112a1afe77f949bc0d6ec6/antd"]]
# VITE_PROXY = [["/api","https://mock.mengxuegu.com/mock/64112a1afe77f949bc0d6ec6"]]
# VITE_PROXY = [["/api-easymock","https://mock.mengxuegu.com"],["/api-fastmock","https://www.fastmock.site"]]

View File

@ -1,9 +0,0 @@
# Vue 3 + TypeScript + Vite
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](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
## Recommended Setup
- [VS Code](https://code.visualstudio.com/) + [Vue - Official](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (previously Volar) and disable Vetur
- Use [vue-tsc](https://github.com/vuejs/language-tools/tree/master/packages/tsc) for performing the same type checking from the command line, or for generating d.ts files for SFCs.

1875
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,8 @@
"commit": "git pull && git add -A && git-cz && git push"
},
"dependencies": {
"@vitejs/plugin-legacy": "^5.4.0",
"@vitejs/plugin-vue2-jsx": "^1.1.1",
"axios": "^1.6.7",
"compression-webpack-plugin": "^11.1.0",
"core-js": "^3.36.0",
@ -33,6 +35,7 @@
"mitt": "^3.0.1",
"moment": "^2.30.1",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.1",
"stylelint-scss": "^6.3.0",
"uuid": "^9.0.1",
"vue": "^3.4.21",
@ -47,6 +50,8 @@
"@commitlint/config-conventional": "^17.8.1",
"@types/crypto-js": "^4.2.2",
"@types/node": "^20.12.10",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^7.1.0",

View File

@ -3,27 +3,9 @@ export default {
reset: 'reset',
register: 'register',
},
home: {
welcome: 'Welcome',
title: 'Bunny-Admin',
},
tabs: {
more: 'More',
refresh: 'Refresh',
maximize: 'Maximize',
closeCurrent: 'Close current',
closeOther: 'Close other',
closeAll: 'Close All',
},
home: {},
tabs: {},
header: {
componentSize: 'Component size',
language: 'Language',
theme: 'theme',
layoutConfig: 'Layout config',
primary: 'primary',
darkMode: 'Dark Mode',
greyMode: 'Grey mode',
weakMode: 'Weak mode',
fullScreen: 'Full Screen',
exitFullScreen: 'Exit Full Screen',
personalData: 'Personal Data',

View File

@ -3,27 +3,9 @@ export default {
reset: '重置',
register: '登录',
},
home: {
welcome: '欢迎使用',
title: 'Bunny-后台管理',
},
tabs: {
more: '更多',
refresh: '刷新',
maximize: '最大化',
closeCurrent: '关闭当前',
closeOther: '关闭其它',
closeAll: '关闭所有',
},
home: {},
tabs: {},
header: {
componentSize: '组件大小',
language: '国际化',
theme: '全局主题',
layoutConfig: '布局设置',
primary: 'primary',
darkMode: '暗黑模式',
greyMode: '灰色模式',
weakMode: '色弱模式',
fullScreen: '全屏',
exitFullScreen: '退出全屏',
personalData: '个人信息',

View File

@ -1,5 +1,7 @@
import directives from '@/directives';
import i18n from '@/i18n/index.ts';
import { createPinia } from 'pinia';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
import { createApp } from 'vue';
import App from './App.vue';
import './assets/css/index.scss';
@ -9,5 +11,8 @@ import router from './router';
const pinia = createPinia();
const app = createApp(App);
app.use(router).use(pinia).use(directives);
// ? pinia 持久化存储
pinia.use(piniaPluginPersistedstate);
app.use(router).use(pinia).use(i18n).use(directives);
app.mount('#app');

16
src/store/template.ts Normal file
View File

@ -0,0 +1,16 @@
import { defineStore } from 'pinia';
export const useHomeStore = defineStore('homeStore', {
// ? 持久化存储
persist: true,
state: () => {
return {
// ? 是否为 true相册模式展示 false 列表展示
articleMode: true,
// ? 排序方式
orderType: 'goods',
};
},
getters: {},
actions: {},
});

View File

@ -1,11 +0,0 @@
import { defineStore } from 'pinia';
export const testStore = defineStore('testStore', {
state: () => {
return {
count: 0,
};
},
getters: {},
actions: {},
});

View File

@ -7,18 +7,22 @@
</li>
</ul>
<Test />
<RouterView />
</template>
<script lang="ts" setup>
import Test from '@/views/test-tsx/index.tsx';
import { pageRoutes } from '@/router/module/pageRoutes';
</script>
<style scoped lang="scss">
<style lang="scss" scoped>
ul {
padding-left: 50px;
li {
list-style: circle !important;
}
a {
color: #8185a7;
}

View File

@ -0,0 +1,7 @@
import { defineComponent } from 'vue';
export default defineComponent({
setup() {
return () => <h1> </h1>;
},
});

View File

@ -1,5 +1,7 @@
{
"compilerOptions": {
// any
"noImplicitAny": false,
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
@ -7,12 +9,13 @@
"ES2020",
"DOM",
"DOM.Iterable"
], "baseUrl": ".",
],
"baseUrl": ".",
"skipLibCheck": true,
"types": [
// "webpack-env"
// "webpack-env"
"node"
],
],
"paths": {
"@/*": [
"src/*"
@ -36,9 +39,9 @@
"src/**/*.tsx",
"src/**/*.vue"
],
"exclude": [
"node_modules"
],
"exclude": [
"node_modules"
],
"references": [
{
"path": "./tsconfig.node.json"

View File

@ -1,9 +1,13 @@
import vue from '@vitejs/plugin-vue';
import { resolve } from 'path';
import { UserConfig, defineConfig } from 'vite';
import { defineConfig, UserConfig } from 'vite';
import legacy from '@vitejs/plugin-legacy';
import vueJsx from '@vitejs/plugin-vue2-jsx';
export default defineConfig(
(): UserConfig => ({
// base: 'www.example.com',// ? 在每个文件前加上这个前缀
// publicDir: './static',// ? 设置静态资源目录
resolve: {
alias: {
'@': resolve(__dirname, './src'),
@ -28,12 +32,16 @@ export default defineConfig(
},
},
},
plugins: [vue()],
plugins: [vue(), legacy({ targets: ['defaults', 'not IE 11'] }), vueJsx()],
esbuild: {
pure: ['console.log', 'debugger'],
jsxFactory: 'h',
jsxFragment: 'Fragment',
jsxInject: "import { h } from 'vue';",
},
// 配置构建过程的选项,例如是否生成压缩文件和源映射
build: {
assetsInlineLimit: 20000,
// 构建输出的目录,默认值为"dist"
outDir: 'dist',
// 用于指定使用的代码压缩工具。在这里minify 被设置为 'terser',表示使用 Terser 进行代码压缩。默认值terser