Skip to content

Commit 85a357d

Browse files
author
hikki
committed
1.5
1 parent c475c05 commit 85a357d

File tree

2 files changed

+19
-33
lines changed

2 files changed

+19
-33
lines changed

resources/assets/component.js

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ class ComponentDot {
6060
let select_str = JSON.stringify(this.select_data);
6161
this.insert_data = [];
6262
this.delete_data = [];
63-
let html = `<div style="width: 100%;height:100%;display: grid; grid-template-rows: 42px auto;border: 1px solid #ccc;border-radius: 5px">
63+
let html = `<style>#${name}-select::-webkit-scrollbar,#${name}-content::-webkit-scrollbar{width: 4px;height: 4px;}
64+
#${name}-select::-webkit-scrollbar-thumb,#${name}-content::-webkit-scrollbar-thumb {border-radius: 5px;-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);background: rgba(0,0,0,0.2);}
65+
#${name}-select::-webkit-scrollbar-track,#${name}-content::-webkit-scrollbar-track {-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);border-radius: 0;background: rgba(0,0,0,0.1);}</style>
66+
<div style="width: 100%;height:100%;display: grid; grid-template-rows: 42px auto;border: 1px solid #ccc;border-radius: 5px">
6467
<div style="display:flex;background: #e1ffa8bf;"><div style="width:120px;background: #e1ffa8bf;">
6568
<input id="${name}-search" type="text" class="form-control" placeholder="搜索名称"></div>
6669
<div id="${name}-select" style="width:100%;overflow: auto;border-bottom: 1px solid #ccc;padding: 3px;border-radius: 0 0 0 14px;background: #ffffffbf;">${selected_dom}</div>
@@ -384,47 +387,28 @@ class ComponentPlane {
384387
}
385388

386389
makeModal() {
387-
/*modal*/
388-
let modal = document.createElement("div");
389-
modal.setAttribute('class', 'modal grid-modal in');
390-
modal.setAttribute('tabindex', '-1');
391-
modal.setAttribute('role', 'dialog');
392-
modal.style = 'display: block;';
393-
/*modal_dialog*/
394-
let mod_dialog = document.createElement("div");
395-
mod_dialog.setAttribute('class', 'modal-dialog modal-lg');
396-
mod_dialog.setAttribute('role', 'document');
397-
mod_dialog.style = `width:${window.innerWidth*this.OPTIONS.W}px`;
398-
/*modal_content*/
399-
let modal_content = document.createElement("div");
400-
modal_content.className = "modal-content";
401-
/*header*/
402-
let modal_header = document.createElement("div");
403-
modal_header.className = 'modal-header';
404-
modal_header.style = 'background-color:#ffffff;padding: 3px;display: flex;justify-content:flex-end;';
390+
console.log(this.OPTIONS.W)
391+
let html = `<div id="dlp" class="modal" style="display: block;">
392+
<div class="modal-dialog modal-lg" style="width: ${window.innerWidth*this.OPTIONS.W}px;">
393+
<div class="modal-content">
394+
<div class="modal-header" style="background-color: rgb(255, 255, 255); padding: 3px; display: flex; justify-content: flex-end;"></div>
395+
<div class="modal-body" style="background-color: rgb(244, 244, 244); padding: 0px; overflow-y: auto; max-height:${window.innerHeight * this.OPTIONS.H}px; min-height: ${window.innerHeight * this.OPTIONS.H / 2}px;"></div>
396+
</div></div></div>`;
397+
document.body.insertAdjacentHTML('beforeEnd', html);
405398
/*X*/
406399
let X = document.createElement('i');
407400
X.setAttribute('class', 'fa fa-close');
408401
X.setAttribute('style', 'cursor: pointer');
409402
X.addEventListener('click', function () {
410-
document.body.removeChild(modal);
403+
if (document.getElementById('dlp') instanceof HTMLElement) {
404+
document.getElementById('dlp').remove();
405+
}
411406
if (document.getElementById('kvFileinputModal') instanceof HTMLElement) {
412407
document.getElementById('kvFileinputModal').remove();
413408
}
414409
},false);
415-
let modal_body = document.createElement('div');
416-
modal_body.className = "modal-body";
417-
modal_body.style = 'background-color:#f4f4f4;padding:0;overflow-y:auto;max-height:' +
418-
window.innerHeight * this.OPTIONS.H + 'px;min-height:' + window.innerHeight * this.OPTIONS.H / 2 + 'px;';
419-
420-
this.MODEL_BODY_DOM = modal_body;
421-
/*create modal*/
422-
modal_header.append(X);
423-
modal_content.append(modal_header);
424-
modal_content.append(modal_body);
425-
mod_dialog.append(modal_content);
426-
modal.appendChild(mod_dialog);
427-
document.body.append(modal);
410+
document.getElementsByClassName('modal-header')[0].append(X);
411+
this.MODEL_BODY_DOM = document.getElementsByClassName('modal-body')[0];
428412
}
429413

430414
makeContent() {

resources/views/content.blade.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<style>
22
.modal-body::-webkit-scrollbar { width: 0 !important }
3+
#component .row{margin: 0}
4+
#component .row>div{padding: 0}
35
</style>
46
<div id="component">
57
{!! $_content_ !!}

0 commit comments

Comments
 (0)