mirror of
https://github.com/archtechx/wire-replace.git
synced 2025-12-12 07:34:02 +00:00
Merge branch 'master' of github.com:LeanAdmin/wire-replace
This commit is contained in:
commit
7768c095a6
1 changed files with 4 additions and 4 deletions
|
|
@ -24,12 +24,12 @@ But:
|
||||||
- it's ugly
|
- it's ugly
|
||||||
- it won't work in situations where you display template that you don't have control over (translated templates, rich text added by users, ...)
|
- it won't work in situations where you display template that you don't have control over (translated templates, rich text added by users, ...)
|
||||||
|
|
||||||
|
A better solution is to have a directive that tells Livewire to **always** replace the element. Sort of like an opposite to `wire:ignore`.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
This package adds two extremely simple directives: `wire:replace` and `wire:replace.self`. Simply use them on elements that you want fully replaced.
|
This package adds two extremely simple directives: `wire:replace` and `wire:replace.self`. Simply use them on elements that you want fully replaced.
|
||||||
|
|
||||||
You can think if this directive as the opposite of `wire:ignore`. `wire:ignore` tells Livewire to **never** replace the element, and `wire:replace` tells Livewire to **always** replace the elemenet.
|
|
||||||
|
|
||||||
To tell Livewire that the element's children should always be replaced:
|
To tell Livewire that the element's children should always be replaced:
|
||||||
```html
|
```html
|
||||||
<div wire:replace>
|
<div wire:replace>
|
||||||
|
|
@ -51,7 +51,7 @@ To tell Livewire that **the element itself plus its children** should always be
|
||||||
### npm dependency
|
### npm dependency
|
||||||
Install the package:
|
Install the package:
|
||||||
```
|
```
|
||||||
npm install --dev leanadmin@wire-replace
|
npm install --dev @leanadmin/wire-replace
|
||||||
```
|
```
|
||||||
|
|
||||||
Register the directive in your `app.js` file:
|
Register the directive in your `app.js` file:
|
||||||
|
|
@ -68,7 +68,7 @@ Simply include the JS file in your layout (**after Livewire's scripts**) and the
|
||||||
```html
|
```html
|
||||||
@livewireScripts
|
@livewireScripts
|
||||||
|
|
||||||
<script src="https://unpkg.com/@leanadmin/wire-replace@0.1.0/"></script>
|
<script src="https://unpkg.com/@leanadmin/wire-replace@0.1.2/dist/wire_replace.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Performance
|
## Performance
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue