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
Adding an empty style throws error #324
Comments
Thanks, this should be fixed in 1.8.12 |
@harlan-zw |
@harlan-zw I did a bit of debugging, it seems something is wrong inside |
Sorry about this, I only had a short amount of time and didn't test the fix properly. I've now pushed a proper fix and also added support for handling styles similar to classes with minimal runtime overhead. Meaning, you can now do things like this: const isNavActive = ref(false)
useHead({
bodyAttrs: {
style: {
'color': 'white',
// fully reactive styles, empty / falsey values are filtered from markup
'background-color': () => isNavActive.value ? 'red' : '',
},
},
}) |
Environment
Doesn't matter.
Reproduction
Describe the bug
Same as the nuxt/nuxt#15488, if you provide an empty string for style property, it throws an error
value.split is not a function
.We need to change
for (const c of value.split(';').filter(Boolean))
to
for (const c of (value || '').split(' ').filter(Boolean)) {
Same as
class
attribute.Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: