event listener 수정

This commit is contained in:
현성필
2024-01-19 23:37:15 +09:00
parent 73e583a749
commit c70d14e2e2
3 changed files with 20 additions and 3 deletions
+13
View File
@@ -546,6 +546,12 @@ class APITester {
console.log(model.queryParams); console.log(model.queryParams);
this.buildPath(model); this.buildPath(model);
editableInput.setValue(model.path); editableInput.setValue(model.path);
$('span.variable').off('mouseover');
$('span.variable').off('mouseout');
document.querySelectorAll('span.variable').forEach(element => {
element.addEventListener('mouseover', () => me.showPopper(element));
element.addEventListener('mouseout', () => me.hidePopper(element));
});
}); });
apiRequestTabContent.find(`#api_request_${model.id}`).find('.api_request_info').find('.path').each(function () { apiRequestTabContent.find(`#api_request_${model.id}`).find('.api_request_info').find('.path').each(function () {
@@ -554,6 +560,12 @@ class APITester {
model.path = value; model.path = value;
model.queryParams = me.parseParam(model.path); model.queryParams = me.parseParam(model.path);
propertyTable.setProperties(model.queryParams); propertyTable.setProperties(model.queryParams);
$('span.variable').off('mouseover');
$('span.variable').off('mouseout');
document.querySelectorAll('span.variable').forEach(element => {
element.addEventListener('mouseover', () => me.showPopper(element));
element.addEventListener('mouseout', () => me.hidePopper(element));
});
}); });
$(this).append(`<label>Path</label>`); $(this).append(`<label>Path</label>`);
@@ -561,6 +573,7 @@ class APITester {
$('span.variable').off('mouseover'); $('span.variable').off('mouseover');
$('span.variable').off('mouseout'); $('span.variable').off('mouseout');
}); });
document.querySelectorAll('.variable').forEach(element => { document.querySelectorAll('.variable').forEach(element => {
@@ -68,7 +68,9 @@ class PropertyTableView {
<div class="editable" data-name="value" data-value="${property.value}"></div> <div class="editable" data-name="value" data-value="${property.value}"></div>
</div> </div>
<div class="prop-table-cell" style="width:100px;"> <div class="prop-table-cell" style="width:100px;">
<button type="button" class="btn btn-secondary btn-sm remove-property" data-index="${index}"><i class="fa fa-sharp fa-minus"></i></button> <button type="button" class="btn btn-secondary btn-sm remove-property" data-index="${index}">
<i class="fa fa-sharp fa-minus" data-index="${index}"></i>
</button>
</div> </div>
</div> </div>
`; `;
@@ -115,6 +117,8 @@ class PropertyTableView {
attachEventListeners() { attachEventListeners() {
this.element.querySelectorAll('.remove-property').forEach(button => { this.element.querySelectorAll('.remove-property').forEach(button => {
button.addEventListener('click', (event) => { button.addEventListener('click', (event) => {
console.log(event.target);
console.log(event.target.getAttribute('data-index'));
const index = parseInt(event.target.getAttribute('data-index'), 10); const index = parseInt(event.target.getAttribute('data-index'), 10);
console.log({index}); console.log({index});
this.propertyTable.controller.removeProperty(index); this.propertyTable.controller.removeProperty(index);
File diff suppressed because one or more lines are too long