第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

對 Jquery 的 Tigger 有點疑問

對 Jquery 的 Tigger 有點疑問

牧羊人nacy 2019-03-15 14:10:34
class Plugin {  constructor(element, options) {    this._setup(element, options);    var pluginName = getPluginName(this);    this.uuid = GetYoDigits(6, pluginName);    if(!this.$element.attr(`data-${pluginName}`)){ this.$element.attr(`data-${pluginName}`, this.uuid); }    if(!this.$element.data('zfPlugin')){ this.$element.data('zfPlugin', this); }    /**     * Fires when the plugin has initialized.     * @event Plugin#init     */    this.$element.trigger(`init.zf.${pluginName}`);  }  destroy() {    this._destroy();    var pluginName = getPluginName(this);    this.$element.removeAttr(`data-${pluginName}`).removeData('zfPlugin')        /**         * Fires when the plugin has been destroyed.         * @event Plugin#destroyed         */        .trigger(`destroyed.zf.${pluginName}`);    for(var prop in this){      this[prop] = null;//clean up script to prep for garbage collection.    }  }}這段代碼里面的this.$element.trigger(`init.zf.${pluginName}`);不是很懂,代碼里面沒有聲明任何 "init.zf.xxx" 這類事件,那這個 trigger 觸發(fā)的是什么?
查看完整描述

2 回答

?
墨色風(fēng)雨

TA貢獻1853條經(jīng)驗 獲得超6個贊

這個事件是提供給使用者使用的,不需要在這里聲明,比如element.on(”xxx”,function(){})


查看完整回答
反對 回復(fù) 2019-04-03
?
呼喚遠(yuǎn)方

TA貢獻1856條經(jīng)驗 獲得超11個贊

The constructor should also call an _init() method, and if needed an _events() method, followed by a DOM event indicating that the plugin is done being initialized.


function Plugin(element, options) {

  // ...


  this._init();

  this._events();

  this.$element.trigger('init.zf.plugin');

}

看到官網(wǎng)的這個表述:followed by a DOM event indicating that the plugin is done being initialized,感覺很迷


查看完整回答
反對 回復(fù) 2019-04-03
  • 2 回答
  • 0 關(guān)注
  • 456 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號