From e662aa7d894a0b259dc1816e79514c1f0d38da9f Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期三, 21 五月 2025 16:14:05 +0800
Subject: [PATCH] Merge branch 'dev-ui' of http://120.26.58.240:8888/r/LifePaymentFront into dev-ui

---
 packages/components/src/components/Input/ChooseInputWithPicker.vue |   52 ++++++++++++++++++----------------------------------
 1 files changed, 18 insertions(+), 34 deletions(-)

diff --git a/packages/components/src/components/Input/ChooseInputWithPicker.vue b/packages/components/src/components/Input/ChooseInputWithPicker.vue
index bd57273..83fe7c2 100644
--- a/packages/components/src/components/Input/ChooseInputWithPicker.vue
+++ b/packages/components/src/components/Input/ChooseInputWithPicker.vue
@@ -1,13 +1,20 @@
 <template>
-  <ChooseInput :modelValue="inputValue" @click="handleOpen()"></ChooseInput>
+  <ChooseInput :modelValue="inputValue" @click="handleOpen()" v-bind="$attrs"></ChooseInput>
+  <Popup v-model:visible="popupVisible" position="bottom">
+    <Picker
+      :modelValue="[modelValue]"
+      :columns="options"
+      @cancel="popupVisible = false"
+      @confirm="handleConfirm"
+    ></Picker>
+  </Popup>
 </template>
 
 <script setup lang="ts">
 import ChooseInput from './ChooseInput.vue';
 import { Popup, Picker } from '@nutui/nutui-taro';
 import { convertOptions, ValueEnum } from 'senin-mini/utils';
-import { Portal } from 'senin-mini/components';
-import { computed, h } from 'vue';
+import { computed, ref } from 'vue';
 
 defineOptions({
   name: 'ChooseInputWithPicker',
@@ -37,37 +44,14 @@
   () => options.value?.find((x) => x.value === props.modelValue)?.text ?? ''
 );
 
+const popupVisible = ref(false);
+
+function handleConfirm({ selectedValue, selectedOptions }) {
+  emit('update:modelValue', selectedOptions[0].value);
+  popupVisible.value = false;
+}
+
 function handleOpen() {
-  const _modelValue = [props.modelValue];
-  Portal.add((key) => {
-    return h(
-      Portal.Container,
-      { keyNumber: key, delayOpen: true },
-      {
-        default: ({ open, onClose }) =>
-          h(
-            Popup,
-            {
-              visible: open.value,
-              'onUpdate:visible': (value) => !value && onClose(),
-              position: 'bottom',
-            },
-            {
-              default: () =>
-                h(Picker, {
-                  modelValue: _modelValue,
-                  columns: options.value,
-                  onCancel: onClose,
-                  onConfirm: ({ selectedValue, selectedOptions }) => {
-                    console.log('selectedValue: ', selectedValue, selectedOptions);
-                    emit('update:modelValue', selectedOptions[0].value);
-                    onClose();
-                  },
-                }),
-            }
-          ),
-      }
-    );
-  });
+  popupVisible.value = true;
 }
 </script>

--
Gitblit v1.9.1