Skip to content
Discussion options

You must be logged in to vote

You need an element between the templates.

But also, you can simplify this by doing

<template x-for ="(variant, index) in CONDITION ? activeFrame.fabric.backgroundImage.variants : []" :key="index">

With this you don't need anything extra

in fact, based on the conditions you show there, you can do just

<template x-for ="(variant, index) in (activeFrame?.fabric?.backgroundImage?.variants ?? [])" :key="index">

This will check if they're defined and if any of them is not defined it will just use an empty array to render nothing.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@slickdaze
Comment options

Answer selected by slickdaze
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants