Migrate all Vue components from Options API to <script setup>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 17:10:06 +08:00
parent a619be7881
commit 3b7b6ae859
61 changed files with 10835 additions and 11750 deletions

View File

@@ -6,6 +6,14 @@ vi.mock('@/module/apiError.js', () => ({
default: vi.fn(),
}));
const mockRoute = vi.hoisted(() => ({
query: {},
}));
vi.mock('vue-router', () => ({
useRoute: () => mockRoute,
}));
import Login from '@/views/Login/Login.vue';
import { useLoginStore } from '@/stores/login';
@@ -15,18 +23,16 @@ describe('Login', () => {
beforeEach(() => {
pinia = createPinia();
setActivePinia(pinia);
mockRoute.query = {};
});
const mountLogin = (options = {}) => {
if (options.route?.query) {
Object.assign(mockRoute.query, options.route.query);
}
return mount(Login, {
global: {
plugins: [pinia],
mocks: {
$route: {
query: {},
...options.route,
},
},
},
});
};