Skip to content

Commit 0f32b46

Browse files
committed
update demo
1 parent cd0bd95 commit 0f32b46

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

test/html/default.case.html

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
var colorPickers = [];
5555
window.onload = function() {
5656
var inputColorPicker = document.getElementById('Input_ColorPicker');
57+
var buttonDestroyAll = document.getElementById('Button_DestroyAll');
58+
var buttonInitAll = document.getElementById('Button_InitAll');
5759
var inputColorPickerGroupWithoutTitle = document.getElementById('Input_ColorPicker_GroupWithoutTitle');
5860
inputColorPicker.colorList = [
5961
{
@@ -70,9 +72,22 @@
7072
]
7173
}
7274
];
73-
Array.prototype.forEach.call(document.querySelectorAll('[data-colorpicker]'), function(input) {
74-
colorPickers.push(new Colorpicker(input));
75-
})
75+
76+
buttonInitAll.addEventListener('click', function() {
77+
Array.prototype.forEach.call(document.querySelectorAll('[data-colorpicker]'), function(input) {
78+
console.log('input', input);
79+
colorPickers.push(new Colorpicker(input));
80+
})
81+
});
82+
83+
buttonDestroyAll.addEventListener('click', function() {
84+
colorPickers.forEach(function(colorpicker) {
85+
colorpicker.destroy();
86+
});
87+
colorPickers = [];
88+
});
89+
90+
7691
}
7792
</script>
7893
</head>
@@ -93,5 +108,10 @@
93108
<legend>Disabled</legend>
94109
<input data-ng-model="default" data-colorpicker type="text" value="" disabled />
95110
</fieldset>
111+
112+
<button id="Button_InitAll">Init All</button>
113+
<button id="Button_DestroyAll">Destroy All</button>
114+
115+
96116
</body>
97117
</html>

0 commit comments

Comments
 (0)