zoukankan      html  css  js  c++  java
  • Vue父子组建之间进行方法调用

    一、父组件调用子组件函数

    父组件:

    <template>
        <child ref="editFun"></child> //子组件绑定
    </template>

    父组件调用子组件函数

    this.$refs.editFun.init(参数);

    子组件:

    methods:{
      init(参数){
      //父组件调用子组件的方法 } }

    二、子组件调用父组件函数

    子组件

    export default{
         props:{
            refreshList:{
                type:Function,
                default:null
         } } }

    子组件调用父组件函数

    this.refreshList(参数);

    父组件:

    <template>
    
    <child :refreshList="initDom"></child>     //子组件绑定
    
    </template>
    
    methods:{
        initDom(参数){}
    }

  • 相关阅读:
    swift
    swift
    swift
    swift
    swift
    swift
    swift
    选择排序
    组合 和 继承
    Android中使用LitePal操控SQLite数据库
  • 原文地址:https://www.cnblogs.com/wangbin96/p/12582213.html
Copyright © 2011-2022 走看看