x-for for CSP build #2724
-
I've been running into a few issues with the CSP build, most recently the main issue is that the x-for directive isn't working at all from what I can tell. (Neither is x-model, there is an open PR for that to fix it.) Is there any way to iterate data with the CSP build? I even tried If this is something that I could help with a PR I would definitely work on that, but I just want to get some direction first to make sure I start down the right path. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
I figured out why this isn't working, but I am not quite sure how to fix. The expression evaluator actually does work in the CSP build (so it is properly finding the key/value part of the expression, so that is not the issue at all here). However, the issue comes in when I try to assign x-text using a dot notation to access part of the value object inside the loop. For example: <template x-for="title in item_titles">
<h1 x-text="title"></h1>
</template> Works fine with CSP build. However, this does not: <template x-for="item in items">
<h1 x-text="item.title"></h1>
</template> Is there anybody that can assist in figuring out how to evaluate the bottom Alternatively, we can also add directive(s) for adding arguments to a function. So you could do something like |
Beta Was this translation helpful? Give feedback.
-
I just found a workaround for anybody having this same issue. Hopefully the CSP plugin will be updated to fix these sorts of issues in the future, but here's the workaround:
Then in getItemTitle I just access the item object via |
Beta Was this translation helpful? Give feedback.
-
Hey @MichaelMackus, thanks for sharing your solution! Did you have any further progress on this issue since your last post? I am having the same issue... |
Beta Was this translation helpful? Give feedback.
I just found a workaround for anybody having this same issue. Hopefully the CSP plugin will be updated to fix these sorts of issues in the future, but here's the workaround:
Then in getItemTitle I just access the item object via
this.$data.item.title
.