File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,11 @@ class="form-control"
2121 .'>
2222 <button
2323 type="button"
24- class="btn btn-primary">
24+ class="btn btn-primary" ' .
25+ $ this ->event ('onclick ' , function () {
26+ return $ this ->setState (['task ' => null ]);
27+ })
28+ .'>
2529 <i class="bi bi-plus"></i>
2630 </button>
2731 </div>
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ public function setState($obj)
4242 {
4343 $ s = [];
4444 foreach ($ obj as $ prop => $ value ) {
45+ if (is_null ($ value )) {
46+ $ value = "null " ;
47+ }
4548 $ s [] = "$ prop: $ value " ;
4649 }
4750 return $ this ->className ().'.setState({ ' .implode (', ' , $ s ).'}) ' ;
@@ -144,6 +147,11 @@ public function inputValue($name)
144147 return ' id=" ' .$ id .'" ' ;
145148 }
146149
150+ public function event ($ event , $ callback )
151+ {
152+ return $ event .'=" ' .$ callback ().'" ' ;
153+ }
154+
147155 public function range ($ start , $ end , $ callback )
148156 {
149157 $ str = '' ;
You can’t perform that action at this time.
0 commit comments