markmead / alpinejs-slug Goto Github PK
View Code? Open in Web Editor NEWTransform a string into a slug with Alpine JS and Slugify ๐
Home Page: https://js.hyperui.dev/examples/form-input-slug
License: MIT License
Transform a string into a slug with Alpine JS and Slugify ๐
Home Page: https://js.hyperui.dev/examples/form-input-slug
License: MIT License
Hi! I can't get the value of x-slug to pass to the livewire component.
If I enter a character in the input after x-slug is set, then it goes to the component.
I am using it with the jetstream inputs <x-jet-input>
inside the modal <x-jet-dialog-modal>
What am I doing wrong?
<x-jet-dialog-modal wire:model='isOpen'>
<x-slot name="title">
{{ isset($this->category->id) ? __('Edit category') : __('Add new category') }}
</x-slot>
<x-slot name="content">
<div x-data="{ name : '' }">
<!-- Name -->
<div class="col-span-6 sm:col-span-4 mt-4">
<x-jet-label for="name" value="{{ __('Name') }}" />
<x-jet-input id="name" type="text" class="mt-1 block w-full" wire:model.defer="name" x-model="name" />
<x-jet-input-error for="name" class="mt-2" />
</div>
<!-- Slug -->
<div class="col-span-6 sm:col-span-4 mt-4">
<x-jet-label for="slug" value="{{ __('Slug') }}" />
<x-jet-input id="slug" type="text" class="mt-1 block w-full" wire:model.defer="slug" x-slug="name"/>
<x-jet-input-error for="slug" class="mt-2" />
</div>
</div>
</x-slot>
<x-slot name="footer">
<x-jet-secondary-button wire:click="closeModal()" wire:loading.attr="disabled">
{{ __('cancel') }}
</x-jet-secondary-button>
@isset($this->category->id)
<x-jet-button class="ml-2" wire:click="update()" wire:loading.attr="disabled">
{{ __('edit') }}
</x-jet-button>
@else
<x-jet-button class="ml-2" wire:click="store()" wire:loading.attr="disabled">
{{ __('add') }}
</x-jet-button>
@endisset
</x-slot>
</x-jet-dialog-modal>
How can I make it only triggers when title changes.
The problem is I can't manually change the slug if I want to. It convert on page loads every time
The element not dispatch the events when the slug got updated
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.