提交 241683a1 编写于 作者: H hdx

fix(form:x-web): radio/checkbox 表单提交的值需和界面一致

上级 60e499d6
......@@ -117,6 +117,9 @@ export default /*#__PURE__*/ defineBuiltInComponent({
}
const { uniCheckGroup, uniLabel } = useCheckboxInject(
//#if _X_ && !_NODE_JS_
rootRef,
//#endif
checkboxChecked,
checkboxValue,
reset
......@@ -209,12 +212,20 @@ export default /*#__PURE__*/ defineBuiltInComponent({
})
function useCheckboxInject(
//#if _X_ && !_NODE_JS_
rootRef: Ref<HTMLElement | null>,
//#endif
checkboxChecked: Ref<string | boolean>,
checkboxValue: Ref<string>,
reset: () => void
) {
const field = computed(() => ({
//#if _X_ && !_NODE_JS_
checkboxChecked: (rootRef.value as UniCheckboxElement as any).checked,
//#else
// @ts-ignore
checkboxChecked: Boolean(checkboxChecked.value),
//#endif
value: checkboxValue.value,
}))
const formField = { reset }
......
......@@ -113,6 +113,9 @@ export default /*#__PURE__*/ defineBuiltInComponent({
}
const { uniCheckGroup, uniLabel, field } = useRadioInject(
//#if _X_ && !_NODE_JS_
rootRef,
//#endif
radioChecked,
radioValue,
reset
......@@ -208,13 +211,21 @@ export default /*#__PURE__*/ defineBuiltInComponent({
})
function useRadioInject(
//#if _X_ && !_NODE_JS_
rootRef: Ref<HTMLElement | null>,
//#endif
radioChecked: Ref<string | boolean>,
radioValue: Ref<string>,
reset: () => void
) {
const field = computed({
get: () => ({
//#if _X_ && !_NODE_JS_
radioChecked: (rootRef.value as UniRadioElement as any).checked,
//#else
// @ts-ignore
radioChecked: Boolean(radioChecked.value),
//#endif
value: radioValue.value,
}),
set: ({ radioChecked: checked }) => {
......
......@@ -82,7 +82,7 @@ class UniSliderElement extends UniElement {
init() {
this.htmlSlider = this.querySelector(
'.uni-slider-brower-input-range'
'.uni-slider-browser-input-range'
) as HTMLInputElement
this.trackValue = this.querySelector(
'.uni-slider-track-value'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册