Skip to content

Commit

Permalink
checkbox 尝试不用watch
Browse files Browse the repository at this point in the history
  • Loading branch information
sunkang committed Aug 23, 2024
1 parent 60b8bf6 commit 8c06de2
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions form/checkbox.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<?php
$checkbox = $name."__model";
?>
<el-form-item label="<?=$label?>" <?=$item_attr?>>
<?php
if($v['value'] && is_array($v['value'])) {
?>
<el-checkbox-group v-model="<?=$checkbox?>">
<el-checkbox-group v-model="<?=$model?>.<?=$name?>">
<?php
foreach($v['value'] as $kk => $vv) {
?>
Expand All @@ -15,19 +12,5 @@
<?php }?>
</el-form-item>
<?php
$vue->data_form($name, "[]");
$vue->data($checkbox,"[]");
$vue->watch($model,"
handler(new_val,old_val){
if(this.".$model.".".$name."){
console.log(11);
this.".$checkbox."=this.".$model.".".$name.";
}
},
deep: true
");
$vue->watch($checkbox."(new_val,old_val)","
console.log(new_val);
this.".$model.".".$name." = new_val;
");
$vue->data_form($name, "[]");
?>

0 comments on commit 8c06de2

Please sign in to comment.