alpine.js

Is there a proper way to wire up Trix editor with Livewire?

◇◆丶佛笑我妖孽 提交于 2021-02-18 17:10:54
问题 When wiring together Trix editor content with Livewire, I am stumbling into problems. I believe that the issue is that when Livewire receives content from Trix, the content is swapped out and Trix becomes disabled. Is there a better way? What I have done, that works, is as follows. At the moment, the page is the redirected to itself in order to reboot Trix (defeating the whole point of Livewire, but it's being used for other things too). <div> <input id="newCommentTextTrixContent" type=

Alpine nested x-data

半世苍凉 提交于 2021-02-10 20:46:16
问题 I am trying to learn Alpine and I am testing out nested x-data. I came across a GitHub issue with nested x-data. They provided a solution which I wanted to try out myself. However, when I try to replicate the code, it didn't print anything. There are no errors in the console too. Can anyone guide me as to what I did wrong? <div x-data="{foo: 'bar'}"> <div x-data="{ }"> <span x-text="foo"></span> </div> </div> I also tried using the $el property but it produced the same result. 回答1: Nesting in

Alpine.js +flatpickr Datetimepicker is not working

谁说我不能喝 提交于 2021-01-29 09:09:16
问题 i really stucked in my project. I have a site with alpine.js where i want to render data to an element Everything is working perfect until the fact that my flatpickr is not shown up. The datepicker is working perfect. It seams, that x-html, x-text nor document.getElementById().innerHTML used in alpine.js is working .... <div x-data="app()" x-html="modalData" x-show="isOpenModal" id="test"> only a test <input class="picker" /> </div> ...... <script> const fp = flatpickr(".picker", { locale:

Dynamically set name attribute of input field in loop with AlpineJS

馋奶兔 提交于 2021-01-29 06:44:03
问题 I'd like to set the name attribute of hidden input fields in a loop with AlpineJS. I've tried x-bind:name but that doesn't work. I think this doesn't work because of the x-model in how todos are added: <input x-model="todoText" type="text"> <button x-on:click.prevent="addTodo('new', todoText)"> Add </button> How can I make the below work so that the index key in the todos array is set to the todoSingle.id value? <template x-for="todoSingle in todoArray" :key="todoSingle.id"> <input type=

How to access a property or a method of alpine.js parent component from a child component?

五迷三道 提交于 2020-12-31 10:55:10
问题 This is kind of an example scenario what the problem looks like, <div x-data="{ count : 0 }"> <div x-data> <span x-text="count"></span> <button x-on:click="count++">Increment</button> <button x-on:click="count--">Decrement</button> </div> </div> It would be able to increase/decrease the data count from the child component. I thought of handling it through dispatching custom events using $dispatch() but then again in terms of design, I might need to write listeners on both parent and child

How to access a property or a method of alpine.js parent component from a child component?

橙三吉。 提交于 2020-12-31 10:54:45
问题 This is kind of an example scenario what the problem looks like, <div x-data="{ count : 0 }"> <div x-data> <span x-text="count"></span> <button x-on:click="count++">Increment</button> <button x-on:click="count--">Decrement</button> </div> </div> It would be able to increase/decrease the data count from the child component. I thought of handling it through dispatching custom events using $dispatch() but then again in terms of design, I might need to write listeners on both parent and child

How to access a property or a method of alpine.js parent component from a child component?

£可爱£侵袭症+ 提交于 2020-12-31 10:54:35
问题 This is kind of an example scenario what the problem looks like, <div x-data="{ count : 0 }"> <div x-data> <span x-text="count"></span> <button x-on:click="count++">Increment</button> <button x-on:click="count--">Decrement</button> </div> </div> It would be able to increase/decrease the data count from the child component. I thought of handling it through dispatching custom events using $dispatch() but then again in terms of design, I might need to write listeners on both parent and child