File tree Expand file tree Collapse file tree 1 file changed +5
-13
lines changed
Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -3100,17 +3100,12 @@ Add a Hook on LiveProp Update
31003100
31013101If you want to run custom code after a specific LiveProp is updated,
31023102you can do it by adding an ``onUpdated `` option set to a public method name
3103- on the component:
3104-
3105- .. code-block :: diff
3106-
3107- // ...
3103+ on the component::
31083104
31093105 #[AsLiveComponent]
31103106 class ProductSearch
31113107 {
3112- - #[LiveProp(writable: true)]
3113- + #[LiveProp(writable: true, onUpdated: 'onQueryUpdated')]
3108+ #[LiveProp(writable: true, onUpdated: 'onQueryUpdated')]
31143109 public string $query = '';
31153110
31163111 // ...
@@ -3121,17 +3116,14 @@ on the component:
31213116 // and its previous value is passed as an argument
31223117 }
31233118 }
3124- }
31253119
3126- As soon as the `query ` LiveProp is updated, the ``onQueryUpdated() `` method
3120+ As soon as the `` query ` ` LiveProp is updated, the ``onQueryUpdated() `` method
31273121will be called. The previous value is passed there as the first argument.
31283122
31293123If you're allowing object properties to be writable, you can also listen to
3130- the change of one specific key:
3124+ the change of one specific key::
31313125
3132- .. code-block ::
3133-
3134- // ...
3126+ use App\Entity\Post;
31353127
31363128 #[AsLiveComponent]
31373129 class EditPost
You can’t perform that action at this time.
0 commit comments