Readouble

Livewire v3 wire:replace

wire:replace

LivewireのDOM diffing は、ページ上の既存の要素を更新するのに役立ちますが、要素の内部状態をリセットするために、一部の要素を最初からレンダリングし直す必要がある場合があります。Livewire's DOM diffing is useful for updating existing elements on your page, but occasionally you may need to force some elements to render from scratch to reset internal state.

このような場合、wire:replace ディレクティブを使用すると、Livewireに要素の子要素のDOM diffing をスキップし、代わりにコンテンツをサーバからの新しい要素で完全に置き換えるように指示できます。In these cases, you can use the wire:replace directive to instruct Livewire to skip DOM diffing on the children of an element, and instead completely replace the content with the new elements from the server.

これは、サードパーティのJavaScriptライブラリやカスタムWebコンポーネントを扱う場合、または要素の再利用が状態を維持する際に問題を引き起こす可能性がある場合に最も役立ちます。This is most useful in the context of working with third-party javascript libraries and custom web components, or when element re-use could cause problems when keeping state.

以下は、shadow DOMを持つWebコンポーネントを wire:replace でラップし、Livewireが要素を完全に置き換えることで、カスタム要素が自身のライフサイクルを処理できるようにする例です。Below is an example of wrapping a web component with a shadow DOM wire:replace so that Livewire completely replaces the element allowing the custom element to handle its own life-cycle:

<form>
    <!-- ... -->

    <div wire:replace>
        <!-- This custom element would have its own internal state -->
        <json-viewer>@json($someProperty)</json-viewer>
    </div>

    <!-- ... -->
</form>

wire:replace.self を使用すると、ターゲット要素とすべての子要素を置き換えるようにLivewireに指示することもできます。You can also instruct Livewire to replace the target element as well as all children with wire:replace.self.

<div x-data="{open: false}" wire:replace.self>
  <!-- Ensure that the "open" state is reset to false on each render -->
</div>

章選択

パッケージ

設定

バージョン変更
linkv3 linkv2
明暗テーマ
light_mode
dark_mode
brightness_auto システム設定に合わせる
テーマ選択
photo_size_select_actual デフォルト
photo_size_select_actual モノクローム(白黒)
photo_size_select_actual Solarized風
photo_size_select_actual GitHub風(青ベース)
photo_size_select_actual Viva(黄緑ベース)
photo_size_select_actual Happy(紫ベース)
photo_size_select_actual Mint(緑ベース)
コードハイライトテーマ選択

明暗テーマごとに、コードハイライトのテーマを指定できます。

テーマ配色確認
スクリーン表示幅
640px
80%
90%
100%

768px以上の幅があるときのドキュメント部分表示幅です。

インデント
無し
1rem
2rem
3rem
原文確認
原文を全行表示
原文を一行ずつ表示
使用しない

※ 段落末のEボタンへカーソルオンで原文をPopupします。

Diff表示形式
色分けのみで区別
行頭の±で区別
削除線と追記で区別

※ [tl!…]形式の挿入削除行の表示形式です。

テストコード表示
両コード表示
Pestのみ表示
PHPUnitのみ表示
OS表示
全OS表示
macOSのみ表示
windowsのみ表示
linuxのみ表示
JSフレームワーク
両フレームワーク
Reactのみ表示
Vueのみ表示
JSのみ表示

(JSが存在しない場合は、他を全表示)

和文変換

対象文字列と置換文字列を半角スペースで区切ってください。(最大5組各10文字まで)

本文フォント

総称名以外はCSSと同様に、"〜"でエスケープしてください。

コードフォント

総称名以外はCSSと同様に、"〜"でエスケープしてください。

保存内容リセット

localStrageに保存してある設定項目をすべて削除し、デフォルト状態へ戻します。

ヘッダー項目移動

キーボード操作