Sign in

Front end page modification tips

jundeven edited in Mon, 16 May 2022

Similar to the online editor of network flow chart, it needs to provide editing, saving and other functions, and give corresponding prompts. For example, after the data is changed, it needs to have a * prompt that is not saved by the editor like word. How to complete the function of comparison response prompt? If data comparison is carried out, will too much data lead to problems such as slow browser.

2 Replies
commented on Mon, 16 May 2022

It is recommended to use Vue to bind data in two directions, and each form item is verified separately with blue.

commented on Tue, 17 May 2022

There are two ways: one is to monitor the modification of page data, and set a flag to true as long as it has been modified, so that when the browser is triggered to close, as long as the flag is true, you can pop up the box to prompt.

The second method is to compare the data directly. If there is an object or an array, it can be directly solved by tostring(), and there is no problem when the data volume is not very large.

As for monitoring browser shutdown events, you can use window.onbeforeunload For details, please refer to https://developer.mozilla.org...

lock This question has been locked and the reply function has been disabled.