waibu-bootstrap
Version:
Bootstrap suport for Waibu Framework
21 lines (17 loc) • 539 B
JavaScript
const cls = 'figure'
async function figure () {
return class Figure extends this.baseFactory {
constructor (options) {
super(options)
this.selector = '.' + cls
this.component.normalizeAttr(this.params, { cls })
}
build = async () => {
const { $ } = this.component
this.params.html = $(`<div>${this.params.html}</div>`).children().each(function () {
if (this.name === 'img') $(this).addClass('figure-img')
}).parent().html()
}
}
}
export default figure