简体   繁体   English

bootstrap 4插件-在jquery中注册的方法

[英]bootstrap 4 plugins - method they are registered in jquery

Reading the bootstrap 4 code (how they register pluging in jquery) I can't understand several lines: 阅读bootstrap 4代码(它们如何注册插入jquery)我看不懂几行:

https://github.com/twbs/bootstrap/blob/v4-dev/js/src/tooltip.js https://github.com/twbs/bootstrap/blob/v4-dev/js/src/tooltip.js

1) Why author add to method Tooltip._jQueryInterface the Constructor property ? 1)为什么作者要在Tooltip._jQueryInterface方法中添加Constructor属性? What kind of functionalyt they try to provide with that? 他们尝试提供哪种功能?

  $.fn[NAME] = Tooltip._jQueryInterface // this is clear
  $.fn[NAME].Constructor = Tooltip  // mmmmm ?

2) what is done there (added noConflict method, but how it will be used?): 2)在那里做什么(添加了noConflict方法,但是将如何使用它?):

  $.fn[NAME].noConflict = function () {
    $.fn[NAME] = JQUERY_NO_CONFLICT
    return Tooltip._jQueryInterface
  }

Now I know the answer on question two (wth is $.fn[NAME].noConflict = function () {..} ). 现在,我知道了第二个问题的答案(这是$.fn[NAME].noConflict = function () {..} )。

According to https://getbootstrap.com/docs/3.3/javascript/#js-noconflict 根据https://getbootstrap.com/docs/3.3/javascript/#js-noconflict

This plugins noconflict method can be used such way: 这个插件的noconflict方法可以这样使用:

var bootstrapButton = $.fn.button.noConflict() // return $.fn.button to previously assigned value
$.fn.bootstrapBtn = bootstrapButton            // give $().bootstrapBtn the Bootstrap functionality

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM