UNPKG

waibu-bootstrap

Version:

Bootstrap suport for Waibu Framework

28 lines (24 loc) 960 B
const cls = 'breadcrumb-item' async function breadcrumbItem () { return class BreadcrumbItem extends this.app.baseClass.MpaWidget { constructor (options) { super(options) this.selector = '.' + cls this.component.normalizeAttr(this.params, { tag: 'li', cls }) } build = async () => { const { omit } = this.app.lib._ const { attrToArray } = this.app.waibu if (this.params.attr.href) { if (this.params.attr.hrefRebuild) { this.params.attr.hrefRebuild = attrToArray(this.params.attr.hrefRebuild) const [path, ...exclude] = this.params.attr.hrefRebuild this.params.attr.href = this.component.buildUrl({ exclude, base: path }) } this.params.html = `<a href="${this.params.attr.href}">${this.params.html}</a>` } this.params.attr = omit(this.params.attr, ['href', 'hrefRebuild']) } } } export default breadcrumbItem