From 5036880fc037e5d112206b93a729f60be12bf8ab Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 07 十一月 2024 17:03:13 +0800
Subject: [PATCH] 2024.11.07 bug修复

---
 components/form/index.wxml |  130 +++++++++++++++++++++++++------------------
 1 files changed, 76 insertions(+), 54 deletions(-)

diff --git a/components/form/index.wxml b/components/form/index.wxml
index b1ab81e..cf20497 100644
--- a/components/form/index.wxml
+++ b/components/form/index.wxml
@@ -1,60 +1,82 @@
-<block wx:for="{{formArr}}" wx:key="index">
-  <block wx:if="{{item.inputType == 'text'}}">
-    <t-input
-      label="{{item.label}}"
-      placeholder="{{item.placeholder}}"
-      value="{{item.value}}"
-      data-index="{{index}}"
-      bind:change="onInputChange"
-    />
-  </block>
-  <block wx:elif="{{item.inputType == 'switch'}}">
-    <t-cell title="{{item.label}}">
-      <t-switch
-        label="{{['鏄�', '鍚�']}}"
-        slot="note"
+<block wx:for="{{formArray}}" wx:key="index">
+  <block wx:if="{{!item.hide}}">
+    <block wx:if="{{item.inputType == 'text'}}">
+      <t-input
+        label="{{item.label}}"
+        placeholder="{{item.placeholder}}"
+        value="{{item.value}}"
         data-index="{{index}}"
-        bind:change="onSwitchChange"
+        bind:change="onInputChange"
       />
-    </t-cell>
-  </block>
-  <block wx:elif="{{item.inputType == 'picker'}}">
-    <t-picker
-      visible="{{item.visible}}"
-      value="{{item.value}}"
-      data-index="{{index}}"
-      title="{{'閫夋嫨' + item.label}}"
-      cancelBtn="鍙栨秷"
-      confirmBtn="纭"
-      bindchange="onPickerChange"
-      bindcancel="onPickerCancel"
-    >
-      <t-picker-item options="{{item.options}}"></t-picker-item>
-    </t-picker>
-  </block>
-  <block wx:elif="{{item.inputType == 'cascader'}}">
-    <t-cell
-      bordered="{{false}}"
-      title="{{item.label}}"
-      arrow
-      hover
-      note="{{item.note}}"
-      data-index="{{index}}"
-      bind:click="showCascader"
-    ></t-cell>
-    <t-cascader
-      visible="{{item.visible}}"
-      value="{{item.value}}"
-      options="{{item.options}}"
-      sub-titles="{{item.cascaderTitles}}"
-      title="{{'閫夋嫨' + item.label}}"
-      data-index="{{index}}"
-      bind:change="onCascaderChange"
-    />
+    </block>
+    <block wx:elif="{{item.inputType == 'switch'}}">
+      <t-cell title="{{item.label}}">
+        <t-switch
+          defaultValue="{{item.value}}"
+          label="{{['鏄�', '鍚�']}}"
+          slot="note"
+          data-index="{{index}}"
+          bind:change="onSwitchChange"
+        />
+      </t-cell>
+    </block>
+    <block wx:elif="{{item.inputType == 'picker'}}">
+      <t-cell
+        title="{{item.label}}"
+        arrow
+        hover
+        note="{{item._label || item.placeholder}}"
+        data-index="{{index}}"
+        bind:click="showPicker"
+      ></t-cell>
+      <t-picker
+        visible="{{item.visible}}"
+        value="{{item._value}}"
+        data-index="{{index}}"
+        title="{{'閫夋嫨' + item.label}}"
+        cancelBtn="鍙栨秷"
+        confirmBtn="纭"
+        bindchange="onPickerChange"
+        bindcancel="onPickerCancel"
+      >
+        <t-picker-item options="{{item.options}}"></t-picker-item>
+      </t-picker>
+    </block>
+    <block wx:elif="{{item.inputType == 'cascader'}}">
+      <t-cell
+        title="{{item.label}}"
+        arrow
+        hover
+        note="{{item.note || item.placeholder}}"
+        data-index="{{index}}"
+        bind:click="showCascader"
+      ></t-cell>
+      <t-cascader
+        visible="{{item.visible}}"
+        value="{{item._value}}"
+        options="{{item.options}}"
+        sub-titles="{{item.cascaderTitles}}"
+        title="{{'閫夋嫨' + item.label}}"
+        data-index="{{index}}"
+        bind:change="onCascaderChange"
+      />
+    </block>
   </block>
 </block>
-
+<slot></slot>
 <view class="btn-group">
-  <t-button block theme="light" content="鍙栨秷" size="small" bind:tap="onCancel"></t-button>
-  <t-button block theme="primary" content="淇濆瓨" size="small" bind:tap="onSubmit"></t-button>
+  <t-button
+    block
+    theme="light"
+    content="{{cancelText}}"
+    size="small"
+    bind:tap="onCancel"
+  ></t-button>
+  <t-button
+    block
+    theme="primary"
+    content="{{submitText}}"
+    size="small"
+    bind:tap="onSubmit"
+  ></t-button>
 </view>

--
Gitblit v1.9.3