diff --git a/order-system/src/components/SysDialog.vue b/order-system/src/components/SysDialog.vue new file mode 100644 index 0000000..10b6c2e --- /dev/null +++ b/order-system/src/components/SysDialog.vue @@ -0,0 +1,103 @@ + + + + + + \ No newline at end of file diff --git a/order-system/src/hooks/useDialog.ts b/order-system/src/hooks/useDialog.ts new file mode 100644 index 0000000..3fec937 --- /dev/null +++ b/order-system/src/hooks/useDialog.ts @@ -0,0 +1,37 @@ +// hooks便于复用 +import { reactive } from "vue" +export default function useDialog(){ + // 定义弹框属性 + // ref: 定义简单、基础数据类型的响应式数据 + // reactive: 定义复杂数据类型的响应式数据 + + const dialog = reactive({ + // title: '新增', + visible: false, + // width: 600, + // height: 100 + }) + + // 弹框关闭 + const onClose = ()=>{ + dialog.visible = false + } + + // 弹框确定 + const onConfirm = ()=>{ + dialog.visible = false + } + + // 显示弹框 + const onShow = ()=>{ + dialog.visible = true + } + + // 将定义的属性及方法返回出去 + return { + dialog, + onClose, + onConfirm, + onShow + } +} \ No newline at end of file diff --git a/order-system/src/http/index.ts b/order-system/src/http/index.ts index a12a83e..335c547 100644 --- a/order-system/src/http/index.ts +++ b/order-system/src/http/index.ts @@ -131,4 +131,5 @@ class Http{ } } +// 导出 export default new Http(config) \ No newline at end of file diff --git a/order-system/src/views/dashboard/Index.vue b/order-system/src/views/dashboard/Index.vue index 8bf3445..402dcf2 100644 --- a/order-system/src/views/dashboard/Index.vue +++ b/order-system/src/views/dashboard/Index.vue @@ -1,10 +1,30 @@ diff --git a/order-system/src/vite-env.d.ts b/order-system/src/vite-env.d.ts index 5d4dd01..1c31ea3 100644 --- a/order-system/src/vite-env.d.ts +++ b/order-system/src/vite-env.d.ts @@ -46,4 +46,11 @@ declare module '@/store/*' { // useCollapseStore导出 export function useCollapseStore(): any; +} + +// 添加hooks路径别名支持 +declare module '@/hooks/useDialog' { + // 我们可以根据实际情况导出具体的类型,如果暂时不想写具体类型,可以导出any + const content: any; + export default content; } \ No newline at end of file