账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    请教下各位关于VUE父组件获取render渲染出的子组件form表单中的值
    30
    0

    使用的iview的modal组件,用的render自定义的modal中的内容,代码如下

     cz (index) {
                    this.$Modal.info(
                        {
                        render: (h) => {
                            return h(Cz,{
                                props:{
                                    index:index,
                                    data1:this.data1,
                                }
                            })
    
                        },
                        title:'调整',
                        closable:true,
                        okText:'确认调整',
    
                        onOk(){
                            console.log()
                        },
                    })
    
    
                },

    子组件代码

    <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>

    因为使用的render渲染,所以好像不可以用ref绑定来进行获取子组件中值。
    目的想通过父组件的onOK()方法,来获取子组件中form表单的中值,向各位请教下!多谢

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部