WebC scoped styles breaks Props? #3404
Unanswered
VAggrippino
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Why would a
webc:scoped
CSS block make a Prop not work.I have some code that passes a number to a component as a Prop. Then the component shows that number of items from a collection.
I'm really happy with how this works, but I want to use different CSS styles for this component than I might use when rendering items from the collection in another context. That seems like a job for
webc:scoped
.Unfortunately, if I add a
<style webc:scoped>
block to the component the prop is no longer available to the component code.If I use the value as the text of an element (e.g.
@text="myvalue"
), the element will just be empty. If I putconsole.log(myvalue)
in thewebc:setup
block, it'll showundefined
in the console, but using it as a value (see the example in the code) just treats it like 0.If I remove the at-sign, it works fine, but then the property will also be set in the rendered HTML.
/index.webc
:/_components/collections-post.webc
:Both of these lines are in my base layout file:
I first discovered this problem while trying to understand how to Pass arguments to a WebC component.
Beta Was this translation helpful? Give feedback.
All reactions