Skip to content
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

Introduce $model magic #2634

Closed
wants to merge 1 commit into from
Closed

Conversation

inxilpro
Copy link
Contributor

@inxilpro inxilpro commented Feb 3, 2022

Usage:

<div x-data="{ foo: 1 }">
  <div x-model="foo">
    <button @click="$model++">+</button>
    <button @click="$model--">-</button>
  </div>
</div>

This is especially helpful for implementing Alpine components. Here's a Laravel blade example:

<!-- Component -->
<div x-model="{{ $xModel }}">
  <button @click="$model--">-</button>
  <div x-text="$model"></div>
  <button @click="$model++">+</button>
</div>

<!-- Usage -->
<div x-data="{ count: 1 }">
  <x-counter x-model="count" />
</div>

@calebporzio
Copy link
Collaborator

Going to hold off on this for now. Thanks Chris!

@calebporzio calebporzio closed this Feb 3, 2022
@Anachron
Copy link

Anachron commented Feb 8, 2022

I know its closed already and put to backlog but I'd like to know how big the performance inpact is here?

Also I dont see any caching?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants