-
I have some components that look like this: <a href="..." x-data="Alpine.component('modalLink')('index', 'products')" x-spread="click">
Products
</a> alpinejs-devtools renders it like this: Also this: Alpine.component('darkModeToggle')() is rendered as Is there some behavior for only looking at the last Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Feel free to PR The function that gets the function name from |
Beta Was this translation helpful? Give feedback.
-
This seems like the best solution: import { AlpineComponent } from '@leanadmin/alpine-typescript';
window.Alpine.onBeforeComponentInitialized(component => {
if (! component.$el.hasAttribute('x-title')) {
if (component.$data.constructor.prototype instanceof AlpineComponent) {
component.$el.setAttribute('x-title', component.$data.constructor.name);
}
}
}); |
Beta Was this translation helpful? Give feedback.
This seems like the best solution: