Closed jennale closed 4 years ago
Nevermind, I see that this might be a clone of #112.
Although, I wonder given that this.$slots and this.$props etc return info as expected, if we could expose some way of accessing this.$customElementAttrs too? Just to provide access programatically, but not necessarily passing it down as this.$attrs
Hi, use e.g. vueInstanceCreatedCallback
(this
should refer to root DOM element) - https://github.com/karol-f/vue-custom-element#options or just this.$root.$el.parentNode.attributes
. Regards.
Hi, use e.g.
vueInstanceCreatedCallback
(this
should refer to root DOM element) - https://github.com/karol-f/vue-custom-element#options or justthis.$root.$el.parentNode.attributes
. Regards.
@karol-f there are differences between this.$el
and this.$root.$el
?
@tiago-freire didn't check it. You can easily try both versions
Hi!
Is there a way of referencing attributes defined on a web-component (which are not defined as props) inside the vue component? This would ideally be done using
this.$attrs
, but I'm wondering if there's already another way.For example:
And the component definition:
Ideally,
console.log(this.$attrs);
would print out an object containingclass
andsomeAttr
. Currently it outputs an empty object.Here's a codeSandbox as well: https://codesandbox.io/s/jovial-morning-41vru