I would like to ask you about the VUE parent component to obtain the values in the form form of the child component rendered by render.

the modal component of iview is used, and the content of modal customized by render is used. The code is as follows

 cz (index) {
                this.$Modal.info(
                    {
                    render: (h) => {
                        return h(Cz,{
                            props:{
                                index:index,
                                data1:this.data1,
                            }
                        })

                    },
                    title:"",
                    closable:true,
                    okText:"",

                    onOk(){
                        console.log()
                    },
                })


            },

Sub-component code

<template>
    <Form :label-width="80"  ref="addForm">
        <FormItem label="">
            <Input type="text" :value="data1[index]["name"]" v-bind:readonly="true"></Input>
        </FormItem>
        <FormItem label="">
            <Input type="text" :value="data1[index]["phone"]" v-bind:readonly="true"></Input>
        </FormItem>
        <FormItem label="">
            <Input v-model="yen" type="text" placeholder=""></Input>
        </FormItem>
        <FormItem label="">
            <Input type="text" value="" ></Input>
        </FormItem>


    </Form>
</template>

<script>
    export default {
        name: "cz",
        props:{
            index:{

            },
            data1:{

            },

        },
        data(){
          return {
              yen:""
          }
        },
        methods:{

        },
        watch:{
            yen:function (data) {
                console.log(data);
            }
        }
    }
</script>

<style scoped>

</style>

because of the render rendering used, it seems that the ref binding cannot be used to retrieve the median values of the subcomponents.
aim to get the median value of the form form in the child component through the onOK () method of the parent component, and ask for your advice! Thank you

Jan.08,2022

this kind of writing interaction and getting data later are too troublesome
you can try this
clipboard.png
viewpayment is a sub-component
so that you can directly operate in the sub-component


this is the modal box component of iView , the last example is the case you encountered, he used the input event to tune back and forth!


would like to ask how the subject solved

Menu