Recently writing Mini Program with mpvue, is there a similar way to manipulate / get dom elements in Mini Program?

to implement a list, add an active class when you click on each item.

liactive

can"t e.currentTarget get the current element? Adding styles has no effect. The format of the output is also different from the previous one

it is not clear whether there is a similar way to operate dom in WeChat Mini Programs. Looking forward to replying ~ Thank you very much?

Mar.02,2021

Why are you operating dom?


the core of a framework like Mini Program and Vue is the binding of template and data, rather than directly manipulating DOM.
you can add a selected attribute to each item selectarr , and then bind it to your style class : class= "{{item.selected}}" to handle the selected value of each item in the click event.


to add a class, you can use a ternary expression, class= "{{'active':curIndex==index}}".
Mini Program provides a method to manipulate dom, https://developers.weixin.qq..
but do not manipulate dom without necessary conditions.

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-1ea54f2-1d45.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-1ea54f2-1d45.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?