@piying/view-vue 2.9.5 → 2.9.7
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 +11 -3
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/util/use-control-value-accessor.d.ts +1 -1
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
|
-
|
|
351
|
+
if (optionalBind) {
|
|
352
|
+
onChange?.(input);
|
|
353
|
+
} else {
|
|
354
|
+
onChange(input);
|
|
355
|
+
}
|
|
352
356
|
value.value = input;
|
|
353
357
|
},
|
|
354
358
|
touchedChange: () => {
|
|
355
|
-
|
|
359
|
+
if (optionalBind) {
|
|
360
|
+
touched?.();
|
|
361
|
+
} else {
|
|
362
|
+
touched();
|
|
363
|
+
}
|
|
356
364
|
}
|
|
357
365
|
}
|
|
358
366
|
};
|