From ebe0eadee4d38f7a5f70722f85d23226fa67c7b8 Mon Sep 17 00:00:00 2001 From: Dream <1012377328@qq.com> Date: Wed, 5 Aug 2026 09:50:55 +0800 Subject: [PATCH] feat(@vben/playground): add typed popup data examples --- .../src/views/examples/drawer/index.vue | 74 ++++++++++++++++++ .../examples/drawer/typed-data-auto-demo.vue | 29 +++++++ .../examples/drawer/typed-data-contract.ts | 13 ++++ .../drawer/typed-data-explicit-demo.vue | 24 ++++++ .../drawer/typed-data-factory-demo.vue | 24 ++++++ playground/src/views/examples/modal/index.vue | 76 +++++++++++++++++++ .../examples/modal/typed-data-auto-demo.vue | 29 +++++++ .../examples/modal/typed-data-contract.ts | 13 ++++ .../modal/typed-data-explicit-demo.vue | 24 ++++++ .../modal/typed-data-factory-demo.vue | 24 ++++++ 10 files changed, 330 insertions(+) create mode 100644 playground/src/views/examples/drawer/typed-data-auto-demo.vue create mode 100644 playground/src/views/examples/drawer/typed-data-contract.ts create mode 100644 playground/src/views/examples/drawer/typed-data-explicit-demo.vue create mode 100644 playground/src/views/examples/drawer/typed-data-factory-demo.vue create mode 100644 playground/src/views/examples/modal/typed-data-auto-demo.vue create mode 100644 playground/src/views/examples/modal/typed-data-contract.ts create mode 100644 playground/src/views/examples/modal/typed-data-explicit-demo.vue create mode 100644 playground/src/views/examples/modal/typed-data-factory-demo.vue diff --git a/playground/src/views/examples/drawer/index.vue b/playground/src/views/examples/drawer/index.vue index 56d98300..b57c5946 100644 --- a/playground/src/views/examples/drawer/index.vue +++ b/playground/src/views/examples/drawer/index.vue @@ -1,6 +1,8 @@ diff --git a/playground/src/views/examples/drawer/typed-data-auto-demo.vue b/playground/src/views/examples/drawer/typed-data-auto-demo.vue new file mode 100644 index 00000000..5af52258 --- /dev/null +++ b/playground/src/views/examples/drawer/typed-data-auto-demo.vue @@ -0,0 +1,29 @@ + + + diff --git a/playground/src/views/examples/drawer/typed-data-contract.ts b/playground/src/views/examples/drawer/typed-data-contract.ts new file mode 100644 index 00000000..96ab8e25 --- /dev/null +++ b/playground/src/views/examples/drawer/typed-data-contract.ts @@ -0,0 +1,13 @@ +import { createVbenDrawer } from '@vben/common-ui'; + +export interface ExplicitDrawerData { + message: string; + method: '显式泛型'; +} + +export interface FactoryDrawerData { + message: string; + method: '契约工厂'; +} + +export const useFactoryDrawer = createVbenDrawer(); diff --git a/playground/src/views/examples/drawer/typed-data-explicit-demo.vue b/playground/src/views/examples/drawer/typed-data-explicit-demo.vue new file mode 100644 index 00000000..cad5315e --- /dev/null +++ b/playground/src/views/examples/drawer/typed-data-explicit-demo.vue @@ -0,0 +1,24 @@ + + + diff --git a/playground/src/views/examples/drawer/typed-data-factory-demo.vue b/playground/src/views/examples/drawer/typed-data-factory-demo.vue new file mode 100644 index 00000000..b4ee168e --- /dev/null +++ b/playground/src/views/examples/drawer/typed-data-factory-demo.vue @@ -0,0 +1,24 @@ + + + diff --git a/playground/src/views/examples/modal/index.vue b/playground/src/views/examples/modal/index.vue index 7b659e4c..5631e7c8 100644 --- a/playground/src/views/examples/modal/index.vue +++ b/playground/src/views/examples/modal/index.vue @@ -1,4 +1,6 @@ + + diff --git a/playground/src/views/examples/modal/typed-data-contract.ts b/playground/src/views/examples/modal/typed-data-contract.ts new file mode 100644 index 00000000..87e74275 --- /dev/null +++ b/playground/src/views/examples/modal/typed-data-contract.ts @@ -0,0 +1,13 @@ +import { createVbenModal } from '@vben/common-ui'; + +export interface ExplicitModalData { + message: string; + method: '显式泛型'; +} + +export interface FactoryModalData { + message: string; + method: '契约工厂'; +} + +export const useFactoryModal = createVbenModal(); diff --git a/playground/src/views/examples/modal/typed-data-explicit-demo.vue b/playground/src/views/examples/modal/typed-data-explicit-demo.vue new file mode 100644 index 00000000..f3300666 --- /dev/null +++ b/playground/src/views/examples/modal/typed-data-explicit-demo.vue @@ -0,0 +1,24 @@ + + + diff --git a/playground/src/views/examples/modal/typed-data-factory-demo.vue b/playground/src/views/examples/modal/typed-data-factory-demo.vue new file mode 100644 index 00000000..4713f848 --- /dev/null +++ b/playground/src/views/examples/modal/typed-data-factory-demo.vue @@ -0,0 +1,24 @@ + + +