@piying/view-vue 2.9.6 → 2.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -323,7 +323,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
323
323
  };
324
324
  }
325
325
  });
326
- function useControlValueAccessor() {
326
+ function useControlValueAccessor(optionalBind) {
327
327
  const value = shallowRef();
328
328
  const disabled = ref(false);
329
329
  let onChange;
@@ -348,11 +348,19 @@ function useControlValueAccessor() {
348
348
  value,
349
349
  disabled,
350
350
  valueChange: (input) => {
351
- onChange(input);
351
+ if (optionalBind) {
352
+ onChange?.(input);
353
+ } else {
354
+ onChange(input);
355
+ }
352
356
  value.value = input;
353
357
  },
354
358
  touchedChange: () => {
355
- touched();
359
+ if (optionalBind) {
360
+ touched?.();
361
+ } else {
362
+ touched();
363
+ }
356
364
  }
357
365
  }
358
366
  };