Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "naive-ui-admin",
"version": "2.0.0",
"type": "module",
"author": {
"name": "Ahjung",
"email": "[email protected]",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const constantRouter: RouteRecordRaw[] = [LoginRoute, RootRoute, Redirect

const router = createRouter({
history: createWebHistory(),
routes: constantRouter,
routes: [...constantRouter, ...asyncRoutes],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里似乎不太妥,asyncRoutes期望是有权限控制的,在路由守卫里面会根据权限动态添加进去

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我再尝试其他处理方式

strict: true,
scrollBehavior: () => ({ left: 0, top: 0 }),
});
Expand Down
2 changes: 1 addition & 1 deletion src/views/form/stepForm/Step1.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</template>

<script lang="ts" setup>
import { ref, defineEmits } from 'vue';
import { ref } from 'vue';
import { useMessage } from 'naive-ui';

const myAccountList = [
Expand Down
2 changes: 1 addition & 1 deletion src/views/form/stepForm/Step2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</template>

<script lang="ts" setup>
import { ref, defineEmits } from 'vue';
import { ref } from 'vue';
import { useMessage } from 'naive-ui';
const form2Ref: any = ref(null);
const message = useMessage();
Expand Down
2 changes: 0 additions & 2 deletions src/views/form/stepForm/Step3.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
</template>

<script lang="ts" setup>
import { defineEmits } from 'vue';

const emit = defineEmits(['finish', 'prevStep']);
function prevStep() {
emit('prevStep');
Expand Down
5 changes: 4 additions & 1 deletion src/views/login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@
const toPath = decodeURIComponent((route.query?.redirect || '/') as string);
message.success('登录成功,即将进入系统');
if (route.name === LOGIN_NAME) {
router.replace('/');
// router.replace('/');
router.isReady().then(() => {
router.push('/');
});
} else router.replace(toPath);
} else {
message.info(msg || '登录失败');
Expand Down
20 changes: 7 additions & 13 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { UserConfig, ConfigEnv } from 'vite';
import { loadEnv } from 'vite';
import { defineConfig, loadEnv } from 'vite';
import { resolve } from 'path';
import { wrapperEnv } from './build/utils';
import { createVitePlugins } from './build/vite/plugin';
import { OUTPUT_DIR } from './build/constant';
import { createProxy } from './build/vite/proxy';
import pkg from './package.json';
import { format } from 'date-fns';

const { dependencies, devDependencies, name, version } = pkg;

const __APP_INFO__ = {
Expand All @@ -18,25 +18,19 @@ function pathResolve(dir: string) {
return resolve(process.cwd(), '.', dir);
}

export default ({ command, mode }: ConfigEnv): UserConfig => {
export default defineConfig(({ command, mode }) => {
const root = process.cwd();
const env = loadEnv(mode, root);
const viteEnv = wrapperEnv(env);
const { VITE_PUBLIC_PATH, VITE_PORT, VITE_PROXY } = viteEnv;
const isBuild = command === 'build';

return {
base: VITE_PUBLIC_PATH,
esbuild: {},
resolve: {
alias: [
{
find: /\/#\//,
replacement: pathResolve('types') + '/',
},
{
find: '@',
replacement: pathResolve('src') + '/',
},
{ find: /\/#\//, replacement: pathResolve('types') + '/' },
{ find: '@', replacement: pathResolve('src') + '/' },
],
dedupe: ['vue'],
},
Expand All @@ -63,4 +57,4 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
chunkSizeWarningLimit: 2000,
},
};
};
});