Function expressions in :if ?
First of all, thank you for sprae, just started playing around with it and I like it a lot!
I was trying to do <pre :if="() => !!(Object.values($selected).filter(x => x).length)"> expecting that when the $selected object does not contain any values in it's props the <pre> element wouldn't show (i tripplechecked, the expression does work and evaluates to either 0 without !! or false when "casting" to bool, I'd expect both to work, e.g. falsy values in :if).
Am I doing something wrong or is not currently not possible to use functions in :if?
thanks for a quick reply and keep the great work up!
Hi @exside! :if takes value directly, it doesn't have to be a function.
Just do <pre :if="!!(Object.values($selected).filter(x => x).length)">.
It makes me wonder if it should take functions as value.
Do you have a particular example where you need :if to be a function and plain code doesn't suffice?
It's pretty massive change, I'll add function support in sprae v12.
Hm, don't add it if it bloats the core too much, guess it might be powerful but could also be unnecessary...
It's there in branch v12, it is not bloating code significantly, I am stuck with somethings else
Fixed by v12. Please test @exside