From 24243ca55c5ec08cef1133e55d6ff068650ab0f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=8D=E5=A6=82=E6=91=B8=E9=B1=BC=E5=8E=BB?=
<1780903673@qq.com>
Date: Mon, 18 Nov 2024 13:09:43 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=20=E2=99=BB=EF=B8=8F=20=20=E9=87=8D?=
=?UTF-8?q?=E6=9E=84Picker=E5=92=8CCell?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/hooks/useColPickerData.ts | 34 +-
src/pages/cell/Index.vue | 18 +-
src/pages/colPicker/Index.vue | 201 +++++---
src/pages/progress/Index.vue | 4 +-
.../common/abstracts/_function.scss | 51 --
.../components/common/abstracts/variable.scss | 52 +-
.../components/wd-action-sheet/types.ts | 8 +-
.../wd-action-sheet/wd-action-sheet.vue | 4 +-
.../components/wd-calendar/index.scss | 136 ------
.../components/wd-calendar/types.ts | 78 +--
.../components/wd-calendar/wd-calendar.vue | 117 +----
.../components/wd-cell/index.scss | 70 ++-
.../components/wd-cell/wd-cell.vue | 71 ++-
.../components/wd-col-picker/index.scss | 164 -------
.../components/wd-col-picker/types.ts | 94 +---
.../wd-col-picker/wd-col-picker.vue | 447 +++++-------------
.../components/wd-datetime-picker/index.scss | 139 ------
.../components/wd-datetime-picker/types.ts | 71 +--
.../wd-datetime-picker/wd-datetime-picker.vue | 95 +---
.../components/wd-form-item/wd-form-item.vue | 6 +-
.../components/wd-input/index.scss | 2 +-
.../components/wd-picker/index.scss | 157 ------
.../components/wd-picker/types.ts | 70 +--
.../components/wd-picker/wd-picker.vue | 104 +---
.../components/wd-progress/index.scss | 10 +-
.../components/wd-progress/types.ts | 15 +-
.../components/wd-progress/wd-progress.vue | 47 +-
.../components/wd-select-picker/index.scss | 133 ------
.../wd-select-picker/wd-select-picker.vue | 108 +----
.../components/wd-textarea/index.scss | 2 +-
30 files changed, 472 insertions(+), 2036 deletions(-)
diff --git a/src/hooks/useColPickerData.ts b/src/hooks/useColPickerData.ts
index 7d1fd563..00cc77fc 100644
--- a/src/hooks/useColPickerData.ts
+++ b/src/hooks/useColPickerData.ts
@@ -1,3 +1,13 @@
+/*
+ * @Author: weisheng
+ * @Date: 2024-11-14 21:27:00
+ * @LastEditTime: 2024-11-14 22:17:54
+ * @LastEditors: weisheng
+ * @Description:
+ * @FilePath: /wot-design-uni/src/hooks/useColPickerData.ts
+ * 记得注释
+ */
+import type { ColPickerOption } from '@/uni_modules/wot-design-uni/components/wd-col-picker/types'
import { useCascaderAreaData } from '@vant/area-data'
export type CascaderOption = {
@@ -15,7 +25,7 @@ export function useColPickerData() {
const colPickerData: CascaderOption[] = useCascaderAreaData()
// 根据code查找子节点,不传code则返回所有节点
- function findChildrenByCode(data: CascaderOption[], code?: string): CascaderOption[] | null {
+ function findChildrenByCode(data: CascaderOption[], code?: string | number): CascaderOption[] | null {
if (!code) {
return data
}
@@ -33,5 +43,25 @@ export function useColPickerData() {
return null
}
- return { colPickerData, findChildrenByCode }
+ function findNodeByCodeList(codeList: string[]): ColPickerOption[] {
+ const result: ColPickerOption[] = []
+ let data = colPickerData
+
+ for (const code of codeList) {
+ const item = data.find((item) => item.value === code)
+ if (item) {
+ result.push({
+ text: item.text,
+ value: item.value
+ })
+ data = item.children || []
+ } else {
+ return result
+ }
+ }
+
+ return result
+ }
+
+ return { colPickerData, findChildrenByCode, findNodeByCodeList }
}
diff --git a/src/pages/cell/Index.vue b/src/pages/cell/Index.vue
index d9ce094c..7f0908cb 100644
--- a/src/pages/cell/Index.vue
+++ b/src/pages/cell/Index.vue
@@ -2,14 +2,14 @@
-
+
-
+
@@ -20,14 +20,14 @@
-
+
-
+
@@ -43,20 +43,20 @@
-
+
-
+
-
+
@@ -74,13 +74,13 @@
-
+
-
+
按钮
diff --git a/src/pages/colPicker/Index.vue b/src/pages/colPicker/Index.vue
index 72d62f25..690c5aab 100644
--- a/src/pages/colPicker/Index.vue
+++ b/src/pages/colPicker/Index.vue
@@ -1,83 +1,143 @@
-
+ handleConfirm({ ...result, index: 1 })"
+ />
+
+ handleConfirm({ ...result, index: 2 })"
+ auto-complete
+ />
+ handleConfirm({ ...result, index: 3 })"
+ />
+
+ handleConfirm({ ...result, index: 4 })"
+ />
+
+ handleConfirm({ ...result, index: 5 })"
+ />
+
+ handleConfirm({ ...result, index: 6 })"
+ />
+
+ handleConfirm({ ...result, index: 7 })"
+ :column-change="columnChange2"
+ />
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 当前选中项: {{ displayValue }}
-
- 选择地址
-
-
-
+
diff --git a/src/pages/progress/Index.vue b/src/pages/progress/Index.vue
index 933e60a8..0e2ba634 100644
--- a/src/pages/progress/Index.vue
+++ b/src/pages/progress/Index.vue
@@ -11,6 +11,7 @@
+
@@ -24,9 +25,10 @@