父组件调用子组件函数,并执行

clusterize() {
      return new Clusterize({
        rows: this.DomArray,
        scrollId: this.scrollId,
        contentId: this.contentId,
        rows_in_block: this.rows_in_block,
        blocks_in_cluster: this.blocks_in_cluster,
        show_no_data_row: this.show_no_data_row,
        no_data_text: this.no_data_text,
        no_data_class: this.no_data_class,
        keep_parity: this.keep_parity,
        tag: this.tag,

        callbacks: (Clusterize.prototype.callbacks = {
          // 在用新的集群替换以前的集群之前会被调用。
          clusterWillChange: function() {
            console.log("在用新的集群替换以前的集群----->之前------>会被调用");
          },
          // 在用新的集群替换之前的集群后会被调用
          clusterChanged: function() {
            console.log("在用新的集群替换之前的集群----->后-------->会被调用");
          },
          // 将被调用滚动。返回进度状态
          scrollingProgress: function(progress) {
            console.log(progress);
          }
        })
      });
      
      

  1. 想给callbacks里面的函数添加回调,想父组件调用的时候可以直接传递函数,让子组件执行。
    有什么方法能够实现呢

阅读 1k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题