Sha256: 7ad041cae37d6c1b3859a3d73075284f239dc9277823b6df26dbd69ef48a5445
Contents?: true
Size: 880 Bytes
Versions: 8
Compression:
Stored size: 880 Bytes
Contents
import { getAlpineData } from "../lib/utils"; export default function nav() { return { empty: false, init() { this.$watch("$store.filter.text", () => this.filter()); this.$nextTick(() => { this.setActive(); this.filter(); }); }, filter() { this.empty = true; this.getChildren().forEach((child) => { const data = getAlpineData(child); data.filter(this.$store.filter.text); if (!data.hidden) { this.empty = false; } }); }, getChildren() { return this.$refs.items ? Array.from(this.$refs.items.querySelectorAll(":scope > li > div")) : []; }, setActive() { const target = this.$el.querySelector( `[data-path="${window.location.pathname}"]` ); this.$store.nav.active = target ? target.id : ""; }, }; }
Version data entries
8 entries across 8 versions & 1 rubygems