hookehuyr

🐞 fix(单选控件): 选项值变化时需要触发自定义事件回传数值

1 <!-- 1 <!--
2 * @Date: 2022-08-30 11:34:19 2 * @Date: 2022-08-30 11:34:19
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-02-01 18:58:00 4 + * @LastEditTime: 2023-02-10 11:04:38
5 * @FilePath: /data-table/src/components/RadioField/index.vue 5 * @FilePath: /data-table/src/components/RadioField/index.vue
6 * @Description: 单项选择控件 6 * @Description: 单项选择控件
7 --> 7 -->
...@@ -68,6 +68,9 @@ const affix_value = ref(''); ...@@ -68,6 +68,9 @@ const affix_value = ref('');
68 68
69 const onChange = (item) => { 69 const onChange = (item) => {
70 clearAffix() 70 clearAffix()
71 + // 发送自定义数据结构
72 + props.item.value = { key: props.item.key, value: radio_value.value, affix: affix_value.value, type: "radio" };
73 + emit("active", props.item.value);
71 } 74 }
72 const onBlur = (item) => { 75 const onBlur = (item) => {
73 clearAffix() 76 clearAffix()
...@@ -86,6 +89,7 @@ const clearAffix = () => { ...@@ -86,6 +89,7 @@ const clearAffix = () => {
86 }); 89 });
87 } 90 }
88 onMounted(() => { 91 onMounted(() => {
92 + radio_value.value = props.item.component_props.default ? props.item.component_props.default : '';
89 // 发送自定义数据结构 93 // 发送自定义数据结构
90 props.item.value = { key: props.item.key, value: radio_value.value, affix: affix_value.value, type: "radio" }; 94 props.item.value = { key: props.item.key, value: radio_value.value, affix: affix_value.value, type: "radio" };
91 emit("active", props.item.value); 95 emit("active", props.item.value);
......