How to make the element disappear beyond the specified time by WeChat Mini Programs

problem description

what can I do because I can"t operate dom to add baby and automatically disappear in 3 hours? Ask for advice

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Aug.24,2021

add a time field to the data, then use the timer to traverse the list data every second, compare the current time with the addition time of each item in the list, and delete the data in more than 3 hours.


if the user is on this page all the time, you can use setTimeout
if you close the page and then open it, you can continue to save the monitoring time for more than 3 hours, which requires background cooperation, or use browser cache


there is no dom, that can be directly manipulated in Mini Program. You can only modify the data to change the front-end rendered page
if you want to not display a certain content after a certain period of time. You can use the wx:if condition for this content when displaying, and modify the display condition regularly to achieve

.

such as

<view wx:if="{{showThisView}}"></view>
Change showThisView to true in the initial data setting of

page

showThisView: true

change showThisView to false through setData after a certain time (you decide the business logic here).

this.setData({showThisView: false})
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b39715-2c177.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b39715-2c177.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?