From 3d104545d40af599e0af1474e5b25b8836bda513 Mon Sep 17 00:00:00 2001 From: Wilson Date: Wed, 28 Aug 2024 21:23:05 +0800 Subject: [PATCH 1/2] fix: missing vue special method --- src/migrator/config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/migrator/config.ts b/src/migrator/config.ts index 054a561..0f9da65 100644 --- a/src/migrator/config.ts +++ b/src/migrator/config.ts @@ -16,6 +16,7 @@ export const vueSpecialMethods = [ 'activated', 'deactivated', 'serverPrefetch', + 'beforeDestroy', 'destroyed', ]; // Vue methods that won't be included under methods: {...}, they go to the root. From 3c6cdc34acdc88e286eae009e56a9ffc244278ce Mon Sep 17 00:00:00 2001 From: Wilson Date: Wed, 28 Aug 2024 21:27:47 +0800 Subject: [PATCH 2/2] test(methods): add beforeDestroy to special method test case --- src/__tests__/vue-class-component/migrator-methods.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/__tests__/vue-class-component/migrator-methods.test.ts b/src/__tests__/vue-class-component/migrator-methods.test.ts index 24d225e..83c2c5a 100644 --- a/src/__tests__/vue-class-component/migrator-methods.test.ts +++ b/src/__tests__/vue-class-component/migrator-methods.test.ts @@ -13,6 +13,9 @@ describe('Methods Property Migration', () => { created() { console.log("OK"); } + beforeDestroy() { + console.log("beforeDestroy triggerd"); + } }`, // Results `import { defineComponent } from "vue"; @@ -20,6 +23,9 @@ describe('Methods Property Migration', () => { export default defineComponent({ created() { console.log("OK"); + }, + beforeDestroy() { + console.log("beforeDestroy triggerd"); } })`, );