请问下怎么做个按钮,按加号后显示减号,然后点击减号后删除,两个按钮变成一个的那种?

小程序 文章 2022-04-23 09:00 379 0 全屏看文

AI助手支持GPT4.0

请问下怎么做个按钮,按加号后显示减号,然后点击减号后删除,两个按钮变成一个的那种?May I ask how to make a button, press the plus sign to display the minus sign, and then click the minus sign to delete, and the two buttons become one?

请问下怎么做个按钮,按加号后显示减号,然后点击减号后删除,两个按钮变成一个的那种?

js不知道怎么写

<view class="selnum" >   <view data-item-index="{{index}}" class="cut" catchtap="cutNumber">-</view>    <input value="{{item.number}}" class="number" disabled="true" type="number" />   <view data-item-index="{{index}}" class="add" catchtap="addNumber" disabled='{{disabled}}'>+</view></view>

js不知道怎么写    -       +

回答:

云D旋律:

可以写个条件做为前端的判断依据:

1.展示加号

2.展示减号

3.展示删除

比如你定义一个:isNum:1,

然后根据点击动态改变这个:this.setData({isNum:2}); 后面的自己完善一下对应的业务就可以了。

雷文敏:怎么进群

-EOF-

AI助手支持GPT4.0