为什么添加了对应的调用函数,点击进度条组件还是无法累加?
来源:2-16 基础组件 - progress

兰柯万
2023-11-10
添加了addPercent函数,但是点击addPercent无法累加,望老师指点
basic.wxml 代码片段
<!-- basic.wxml -->
<icon type="success" size="66" color="blue "></icon>
<icon type="success_no_circle" size="66" ></icon>
<icon type="info" size="66" ></icon>
<icon type="warn" size="66" ></icon>
<icon type="waiting" size="66" ></icon>
<icon type="cancel" size="66" ></icon>
<icon type="download" size="66" ></icon>
<icon type="search" size="66" ></icon>
<icon type="clear" size="66" ></icon>
<view>
<view>这是一个view文本内容</view>
<text selectable="{{true}}">这是一段\t文本\n内容</text>
</view>
<view>
<text space="{{true}}">space 空格 内容</text>
</view>
<view>
<text decode="{{true}}"> < > & '    </text>
</view>
<rich-text nodes="{{mycontent}}"></rich-text>
<rich-text nodes="{{mycontent2}}"></rich-text>
<progress percent="42" show-info="true" stroke-width="20"
color="" activeColor="red" backgroundColor="blue" active="true">
</progress>
<progress percent="{{myprecent}}" show-info="true" stroke-width="20" active-mode="forwards">
</progress>
<view bind:tap="addPercent">addPrercent</view>
basic.js 代码片段
// basic.js
Page({
data: {
iconSize: [20, 30, 40, 50, 60, 70],
iconColor: [
'red', 'orange', 'yellow', 'green', 'rgb(0,255,255)', 'blue', 'purple'
],
iconType: [
'success', 'success_no_circle', 'info', 'warn', 'waiting', 'cancel', 'download', 'search', 'clear'
],
mycontent : '<img class="course-banner" src="//img1.sycdn.imooc.com/szimg/623931dc09c59e7600000000.png" />',
mycontent2 : [
{
name: "img",
attrs: {
class: "course-banner",
src: "//img1.sycdn.imooc.com/szimg/623931dc09c59e7600000000.png"
}
}
],
myprecent : 15,
addPercent: function() {
var newPercent = this.data.myprecent + 20;
this.setData({
myprecent: newPercent
})
}
}
})
写回答
1回答
-
看下你的这个函数能不能一步步执行。打log看下,另外看看有么有报错 ,没有报错说明逻辑控制错了噢
112023-11-13
相似问题