浏览代码

自定义form

zhaoxiaohai 3 年之前
父节点
当前提交
ffe1933ebf
共有 2 个文件被更改,包括 7 次插入0 次删除
  1. 3 0
      components/My_form/index.js
  2. 4 0
      components/My_form/index.wxml

+ 3 - 0
components/My_form/index.js

@@ -10,6 +10,9 @@ Component({
         },
         CompletedOrNot: Function, //完成与否回调
     },
+    options: {
+        multipleSlots: true
+    },
 
     /**
      * 组件的初始数据

+ 4 - 0
components/My_form/index.wxml

@@ -8,5 +8,9 @@
                 </view>
             </picker>
         </view>
+        <slot name='slot1' wx:if="{{item.type=='custom'}}" slot='input' />
+        <slot name='slot2' wx:if="{{item.type=='custom'}}" slot='input' />
+        <slot name='slot3' wx:if="{{item.type=='custom'}}" slot='input' />
+        <slot name='slot4' wx:if="{{item.type=='custom'}}" slot='input' />
     </van-field>
 </van-cell-group>