appstore/dist/lib/ui/views/breadcrumb.js

12 lines
833 B
JavaScript
Raw Permalink Normal View History

2023-12-19 15:30:29 +08:00
import{css as s,html as i,Component as l,styleMap as n}from"wkit";class o extends l{static styles=[s`:host{display:flex;align-items:center;width:100%;height:32px;font-size:14px}`];#e(m){let t=Array.from(this.children);t.forEach((e,r)=>{e.tagName==="WC-BREADCRUMB-ITEM"?e.last=t.length===r+1:e.remove()})}mounted(){this.#e()}}class p extends l{static props={separator:"/",last:"bool!"};static styles=[s`:host,.item{display:inline-flex;align-items:center;height:32px;font-size:14px}.pipe{margin:0 8px;user-select:none}`];render(){return i`
<label class="item">
<slot></slot>
<span
class="pipe"
style=${n({display:this.last?"none":""})}
>
<slot name="separator">${this.separator||"/"}</slot>
</span>
</label>
`}}o.reg("breadcrumb"),p.reg("breadcrumb-item");