add alias @ as path

This commit is contained in:
simple321vip
2023-01-28 17:19:05 +08:00
parent e7cf872567
commit 67eaa3ad40
6 changed files with 46 additions and 7 deletions
+23 -1
View File
@@ -1,3 +1,5 @@
import { Tenant } from '@/entity';
import { tenantStore } from '@/store/modules/tenant';
import router from '../router'
import { setToken, setTenant } from '../utils/auth'
@@ -41,7 +43,27 @@ const scan_method: any = {
production: (qrcode: string) => {
window.location.href = qrcode
},
development: () => {
development: async () => {
const useTenantStore = tenantStore()
const tenant: Tenant = {
tenant_id: '7788',
account: '小小的测试账户'
}
let token = 'ABCDEFG'
await useTenantStore.login(tenant, token).then(() => {
const { href } = router.resolve({
path: '/'
})
window.open(href, '_self')
}).catch((error) => {
const { href } = router.resolve({
path: '/login'
})
window.open(href, '_self')
})
setToken("token")
setTenant(
{
+3 -3
View File
@@ -34,10 +34,10 @@ const routes: Array<RouteRecordRaw> = [
}
},
{
path: '/thinking',
component: () => import('../view/thinking/index.vue'),
path: '/calendar',
component: () => import('../view/calendar/index.vue'),
meta: {
name: '感悟人生'
name: '日历'
}
},
{
+1 -1
View File
@@ -53,7 +53,7 @@
</template>
<script setup lang="ts">
import { reactive, ref } from 'vue';
import { reactive, ref } from 'vue'
import { delete_bookmark_type, post_bookmark_type, get_bookmark_type } from '../../api/bookmark_type'
import type { FormInstance } from 'element-plus'
const formLabelWidth = '140px'
+6
View File
@@ -1,5 +1,11 @@
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*": [
"./src/*"
]
},
"target": "esnext",
"useDefineForClassFields": true,
"module": "esnext",
+13 -2
View File
@@ -1,7 +1,8 @@
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import viteCompression from 'vite-plugin-compression';
import viteCompression from 'vite-plugin-compression'
import { viteMockServe } from 'vite-plugin-mock'
import { resolve } from 'path'
// https://vitejs.cn/guide/env-and-mode.html#env-files
export default defineConfig(({ mode }) => {
@@ -16,6 +17,16 @@ export default defineConfig(({ mode }) => {
localEnabled: true,
}),
],
base: env.VITE_RES_URL
base: env.VITE_RES_URL,
resolve: {
alias: {
'@': resolve(__dirname, 'src')
}
},
css: {
preprocessorOptions: {
}
}
}
})