Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
calebporzio committed May 10, 2023
1 parent 65407a6 commit 61f6459
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
29 changes: 29 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,35 @@
<!-- <script src="//cdn.tailwindcss.com"></script> -->
<!-- <script src="//cdn.tailwindcss.com"></script> -->

<div x-data="{
my_array: [{x:'x'},{x:'y'}],
click() {
this.my_array = [{x:'a'},{x:'b'}];
}
}">

<!-- Loop with plain div -->
<template x-for="item in my_array">
<div x-text="item.x"></div>
</template>

<!-- Loop with div nested inside component -->
<template x-for="item in my_array">
<div x-data="some_component" >
<div x-text="item.x"></div>
</div>
</template>

<button @click="click">Click me</button>

</div>
<script>
document.addEventListener('alpine:init', () => {
Alpine.data('some_component', () => ({}));
});

</script>




Expand Down
3 changes: 2 additions & 1 deletion packages/alpinejs/src/alpine.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { setReactivityEngine, disableEffectScheduling, reactive, effect, release, raw } from './reactivity'
import { mapAttributes, directive, setPrefix as prefix, prefix as prefixed } from './directives'
import { start, addRootSelector, addInitSelector, closestRoot, findClosest, initTree, destroyTree, interceptInit } from './lifecycle'
import { mutateDom, deferMutations, flushAndStopDeferringMutations, startObservingMutations, stopObservingMutations } from './mutation'
import { onAttributeRemoved, mutateDom, deferMutations, flushAndStopDeferringMutations, startObservingMutations, stopObservingMutations } from './mutation'
import { mergeProxies, closestDataStack, addScopeToNode, scope as $data } from './scope'
import { setEvaluator, evaluate, evaluateLater, dontAutoEvaluateFunctions } from './evaluator'
import { transition } from './directives/x-transition'
Expand Down Expand Up @@ -32,6 +32,7 @@ let Alpine = {
startObservingMutations,
stopObservingMutations,
setReactivityEngine,
onAttributeRemoved,
closestDataStack,
skipDuringClone,
onlyDuringClone,
Expand Down

0 comments on commit 61f6459

Please sign in to comment.