浏览代码

添加自定义选项

zhaoxiaohai 3 年之前
父节点
当前提交
789706977c
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      components/Yl_field/index.js

+ 8 - 0
components/Yl_field/index.js

@@ -84,6 +84,14 @@ Component({
             });
             this.confirm();
         },
+        /* 自定义选项 */
+        setOption(item) {
+            let i = this.data.form.findIndex(v => v.valueName == item.valueName);
+            this.setData({
+                [`form[${i}].value`]: item.value
+            });
+            this.confirm();
+        },
         /* 是否完成必填项 */
         confirm() {
             this.triggerEvent("onConfirm", this.data.form.some(v => v.required && v.value == ''))