-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Components don’t have access to props data within webc:setup
script tags
#196
Comments
I had the same problem. I was expecting that the Anyhow, I figured out, I can pass the variable from evaluated attributes like <script webc:setup>
// const [l, c, h] = color.split(' '); // does not work!
const value = (color) => {
const [l, c, h] = color.split(' ');
return `${Math.round(l * 1000) / 10}%, ${c}, ${h}°`
};
const css = (color) => `oklch(${color})`;
const lightness = (color) => `${Math.round(color.split(' ')[0] * 1000) / 10}%`;
const chroma = (color) => `${color.split(' ')[1]}`;
const hue = (color) => `${color.split(' ')[2]}°`;
</script> |
I have the same issue. I created a component and wanted to do some props processing in |
@alexnozer can you provide some example code? |
Oof, this got me too. @patrulea in your example:
|
I can’t figure out why I can’t reference component props when trying to set up data with
<script webc:setup>
, as it just crashes the build.index.webc
some-component.webc
How should I approach this?
The text was updated successfully, but these errors were encountered: