The website needs to be adapted on the mobile side. For mobile H5 and web sides, flex layout solutions such as bluma are used.
The list used in H5 uses react-virtualized to draw the table
In order to display the specific details of a single row of data in the table, the usual solution is to use a new page or a pop-up window.
The pop-up window solution is used here. The data details after clicking on a single row of data use bluma's modal-card.
For specific details and examples, please refer to: https://bulma.io/documentation/components/modal/
Problem details:After clicking on a single row of data, a pop-up window displays detailed data, and the entire modal-card is set to position:fixed;
There is no footer part, set the height of modal-card to the height of the entire screen: 100vh
Performance:
Solution:
modal-card's own solution:JS + CSS overflow:hidden
Dynamically add css classes to the page html under the pop-up window through JS
if ($modalButtons.length > 0) { $modalButtons.forEach(function ($el) { $el.addEventListener('click', function () { var target = $el.dataset.target; openModal(target); } ); });}function openModal(target) { var $target = document.getElementById(target); rootEl.classList.add('is-clipped'); $target.classList.add('is-active');}Use overflow:hidden to disable page scrolling
is-clipped { overflow:hidden!important}
When the pop-up window is closed, delete the css class of the page through JS: is-clipped
function closeModals() { rootEl.classList.remove('is-clipped'); $modals.forEach(function ($el) { $el.classList.remove('is-active'); });}
However, after testing this solution in the application, it was found that it did not solve the problem, and the above problems still occurred.
position:fixed solutionJS + CSS Position:fixed + scrollTop
Plan ideas:
Before the pop-up window:
const scrollTop = global.document.documentElement.scrollTop || global.pageYOffset || global.document.body.scrollTop;global.document.documentElement.style.position = 'fixed';this.scrollTop = scrollTop;
Close the pop-up window:
closeModalHandler = () => { const { closeOrderHistoryModal } = this.props; global.document.documentElement.style.position = ''; global.pageYOffset = this.scrollTop; global.document.documentElement.scrollTop = this.scrollTop; global .document.body.scrollTop = this.scrollTop; closeOrderHistoryModal();}
The above is the entire content of this article. I hope it will be helpful to everyone’s study. I also hope everyone will support VeVb Wulin Network.