File tree 2 files changed +9
-1
lines changed
packages/ui-predicate-vue
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div id =" app" >
3
3
<h1 >Simple ui-predicate usage</h1 >
4
- <ui-predicate :config =" config" @onChange =" onChange" ></ui-predicate >
4
+ <ui-predicate :config =" config" @change = " onChange" @init =" onChange" ></ui-predicate >
5
5
<p >Tips: Use "alt + click" to create a sub-group.</p >
6
6
<pre >{{ ast }}</pre >
7
7
</div >
Original file line number Diff line number Diff line change @@ -74,6 +74,10 @@ module.exports = {
74
74
this .setIsInAddCompoundMode (false );
75
75
}
76
76
},
77
+ onChange (ctrl ) {
78
+ // emit 'change' event
79
+ this .$emit (' change' , ctrl);
80
+ },
77
81
},
78
82
mounted () {
79
83
const vm = this ;
@@ -86,6 +90,9 @@ module.exports = {
86
90
vm .ctrl = ctrl;
87
91
vm .root = ctrl .root ;
88
92
vm .columns = ctrl .columns ;
93
+ // emit 'init' event
94
+ vm .$emit (' init' , ctrl);
95
+ ctrl .on (' changed' , vm .onChange );
89
96
},
90
97
err => {
91
98
console .error (err);
@@ -97,6 +104,7 @@ module.exports = {
97
104
window .addEventListener (' keydown' , this .onAltPressed );
98
105
},
99
106
destroyed () {
107
+ this .ctrl .off ();
100
108
window .removeEventListener (' keyup' , this .onAltReleased );
101
109
window .removeEventListener (' keydown' , this .onAltPressed );
102
110
},
You can’t perform that action at this time.
0 commit comments