HomeDashboard/.venv/lib/python3.12/site-packages/nicegui/elements/link.js
2026-01-03 14:54:18 +01:00

24 lines
533 B
JavaScript

export default {
template: `<a :href="computed_href" :target="target"><slot></slot></a>`,
mounted() {
setTimeout(this.compute_href, 0); // NOTE: wait for window.path_prefix to be set in app.mounted()
},
updated() {
this.compute_href();
},
methods: {
compute_href() {
this.computed_href = (this.href.startsWith("/") ? window.path_prefix : "") + this.href;
},
},
props: {
href: String,
target: String,
},
data: function () {
return {
computed_href: this.href,
};
},
};