UNPKG

waibu-bootstrap

Version:

Bootstrap suport for Waibu Framework

31 lines (27 loc) 1.01 kB
const cls = 'nav' const types = ['tabs', 'pills', 'underline'] async function nav () { return class Nav extends this.baseFactory { constructor (options) { super(options) const { isString } = this.plugin.lib._ this.selector = '.' + cls this.component.normalizeAttr(this.params, { tag: 'nav', cls }) if (types.includes(this.params.attr.type)) this.params.attr.class.push(`nav-${this.params.attr.type}`) if (this.params.attr.fill) this.params.attr.class.push('nav-fill') if (isString(this.params.attr.tag)) this.params.tag = this.params.attr.tag } build = async () => { const { $ } = this.component if (!['ol', 'ul'].includes(this.params.tag)) { const html = [] $(`<div>${this.params.html}</div>`).children().each(function () { html.push($(this).html()) }) this.params.html = html.join('\n') } delete this.params.attr.type } } } export default nav