text: /**
   * Bind after-leave event for vue instance. Make sure after-leave is called in any browsers.
   * 为vue实例绑定after-leave事件。
  确保在任何浏览器中都调用after-leave。
   *
   * @param {Vue} instance Vue instance.
   * @param {Function} callback callback of after-leave event
   * @param {Number} speed the speed of transition, default value is 300ms。转换速度
   * @param {Boolean} once weather bind after-leave once. default value is false. after-leave是否绑定一次。默认值是false。
   */
  // called为开关。
  // called先是为false，代表开着状态，进入回调事件后，把它关上，回调事件绑定所有参数。
  // 为true即是关上状态，进入回调后马上退出。
  
  export default function(instance, callback, speed = 300, once = false) {
    // 实例和回调方法是必须的
    if (!instance || !callback) throw new Error('instance & callback is required');
    let called = false;
    const afterLeaveCallback = function() {
      if (called) return;
      called = true;
      if (callback) {
        callback.apply(null, arguments);
      }
    };
    if (once) {
      // 只调用一次
      instance.$once('after-leave', afterLeaveCallback);
    } else {
      instance.$on('after-leave', afterLeaveCallback);
    }
    setTimeout(() => {
      afterLeaveCallback();
    }, speed + 100);
  };
  