From ee4eccd03449bf408d16e2fc58c0504617925829 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Fri, 8 Jan 2021 12:12:56 +0800 Subject: [PATCH] Roo/bootstrap/breadcrumb/Item.js --- Roo/bootstrap/breadcrumb/Item.js | 77 ++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 Roo/bootstrap/breadcrumb/Item.js diff --git a/Roo/bootstrap/breadcrumb/Item.js b/Roo/bootstrap/breadcrumb/Item.js new file mode 100644 index 0000000000..1cd46025d2 --- /dev/null +++ b/Roo/bootstrap/breadcrumb/Item.js @@ -0,0 +1,77 @@ +/* + * - LGPL + * + * Breadcrumb Item + * + */ + + +/** + * @class Roo.bootstrap.breadcrumb.Nav + * @extends Roo.bootstrap.Component + * Bootstrap Breadcrumb Nav Class + * + * @children Roo.bootstrap.breadcrumb.Component + * @cfg {String} html the content of the link. + * @cfg {String} href where it links to if '#' is used the link will be handled by onClick. + + * + * @constructor + * Create a new breadcrumb.Nav + * @param {Object} config The config object + */ + +Roo.bootstrap.breadcrumb.Item = function(config){ + Roo.bootstrap.breadcrumb.Item.superclass.constructor.call(this, config); + this.addEvents({ + // img events + /** + * @event click + * The img click event for the img. + * @param {Roo.EventObject} e + */ + "click" : true + }); + +}; + +Roo.extend(Roo.bootstrap.breadcrumb.Item, Roo.bootstrap.Component, { + + href: false, + html : '', + + getAutoCreate : function() + { + + var cfg = { + tag: 'li' + }; + if (this.href !== false) { + cfg.cn = [{ + tag : 'a', + href : this.href, + html : this.html + }]; + } else { + cfg.html = this.html; + } + + return cfg; + }, + + initEvents: function() + { + if (this.href) { + this.el.select('a', true).first().onClick(this.onClick, this) + } + + }, + onClick : function(e) + { + e.preventDefault(); + this.fireEvent('click',this, e); + } + +}); + + \ No newline at end of file -- 2.39.2