Urgent, novice, how can WeChat Mini Programs click the button to remove the item?

clipboard.png

< hr >

1. How does WeChat Mini Programs remove the item after clicking on the favorites pop-up window and clicking OK?

2, and how do you add background to the tabbar at the bottom of WeChat Mini Programs?

novice, thank you very much for your advice.

Apr.05,2021

1. I don't know whether your so-called removal is deleted or hidden, if it is deleted, just execute the deletion method directly. If it is hidden, add status to each item, hidden or wx:if to determine whether it is displayed or not, and the data is docked with the background.
2.tabbar background
https://developers.weixin.qq.


wx.showModal ({
title: 'prompt',
content: 'this is a modal pop-up window',
success: function (res) {

)
if (res.confirm) {
  console.log('')
} else if (res.cancel) {
  console.log('')
}

}
})
look at the callback, and the user clicks OK to execute the upstairs answer.


after clicking, you can call a method to change the data,
such as
function delete (index) {

  list.splice(index,1);
  this.setData({list});

};
has some examples: https://github.com/meibin08/


render the data of your favorite list as an array. When you bind button events, you can pass the objects in this array, and then process a

in the array.

under this object, delete it or change the control variable, depending on your own business logic.

for example, if you use the wx:if, on the 1st floor to say wx:if= "{{item.isShow}}", you can change the isShow field of this object to false.

Menu