请技术高手帮忙看看。使用的组件数量接近三四十个,几乎都需要事件响应。输入框离开时触发,下拉选择也触发。使用真机调试下拉框弹出来的数据的比较慢
js部分代码:
p_width: function (event) {
this.data.p_width = event.detail
let ab = ((this.data.p_long + this.data.p_width) * 2) / 1000 / 13 * 9
this.setData({
pv_width: event.detail,
pv_silica_gel: ab.toPrecision(1)
})
},
p_long: function (event) {
this.data.p_long = event.detail
this.setData({
pv_long: event.detail
})
},
p_height: function (event) {
this.setData({
pv_height: event.detail
})
},
p_pailei_a: function (event) {
this.data.p_pailei_a = event.detail
this.setData({
pv_pailei_a: event.detail
})
},
p_pailei_b: function (event) {
this.data.p_pailei_b = event.detail
this.setData({
pv_pailei_b: event.detail
})
},
p_battery_long: function (event) {
this.data.p_battery_long = event.detail
this.setData({
pv_battery_long: event.detail
})
},
p_battery_width: function (event) {
this.data.p_b_width = event.detail
let a = event.detail / this.data.p_battery_long * this.data.p_pailei_a * this.data.p_pailei_b
let ab = a * 0.01 * 4.5
this.data.aa = a
this.setData({
pv_battery_width: event.detail,
pv_djzp_waat: a.toPrecision(2),
pv_other: ab.toPrecision(2)
})
},
。。。。。。
。。。略部分代码。。。
。。。。。
p_welding_price: function (event) {
let jj = (this.data.p_b_width) * 1.8 * (this.data.p_pailei_a) * (this.data.p_pailei_b + 1) * 5 / 1000 * 0.0022 * event.detail
// console.log(jj)
this.setData({
pv_welding_price: event.detail,
pv_welding: jj.toPrecision(2)
})
},
p_welding_p: function (event) {
let kk = (this.data.p_b_width) * 1.8 * (this.data.p_pailei_a) * (this.data.p_pailei_b + 1) * 5 / 1000 * 0.0022 * event.detail.value
this.setData({
pv_welding: kk.toPrecision(2)
})
},
p_bus_price: function (event) {
this.setData({
pv_bus_price: event.detail
})
},
p_border_price: function (event) {
let ll = ((this.data.p_long + this.data.p_width) * 2 * event.detail)/1000
// console.log(jj)
this.setData({
pv_border_price: event.detail,
pv_border: ll.toPrecision(2)
})
},
p_border_p: function (event) {
let mm = ((this.data.p_long + this.data.p_width) * 2 * event.detail.value)/1000
this.setData({
pv_border: mm.toPrecision(2)
})
},
在开发工具中调试速度还算正常,只要上真机调试速度就慢了,,,
wxml部分代码
也遇到了同样的问题,有找到解决办法了吗?
我也是 请问怎么解决的呢?
我也遇到类似问题,使用的van-dropdown-menu,真机弹出缓慢,要等10秒,你是怎么解决的?
wxml部分代码 <form bindsubmit="onSubmit"> <view class="content"> <view > <view class="content-align-left"> <van-cell-group> <van-field name='pv_long' value="{{ pv_long }}" label="组件长度" placeholder="请填写组件长度" border="{{ false }}" /> </van-cell-group> </view> <view class="content-align-right"> <van-dropdown-menu> <van-dropdown-item value="{{ value1 }}" options="{{ option1 }}" bindchange="p_long" /> </van-dropdown-menu> </view> </view> <view> <view class="content-align-left"> <van-cell-group> <van-field name='pv_width' border="{{ false }}" value="{{ pv_width }}" label="组件宽度" placeholder="请填写组件宽度" /> </van-cell-group> </view> <view class="content-align-right"> <van-dropdown-menu> <van-dropdown-item value="{{ value2 }}" options="{{ option2 }}" bindchange="p_width" /> </van-dropdown-menu> </view> </view> <view> <view class="content-align-left"> <van-cell-group> <van-field name='pv_height' border="{{ false }}" value="{{ pv_height }}" label="组件高度" placeholder="请填写组件高度" /> </van-cell-group> </view> <view class="content-align-right"> <van-dropdown-menu> <van-dropdown-item value="{{ value3 }}" options="{{ option3 }}" bindchange="p_height" /> </van-dropdown-menu> </view> </view> 。 。。。 <view > <view class="content-align-left"> <van-cell-group > <van-field name='pv_glass_price' value="{{ pv_glass_price }}" label="玻璃单价" placeholder="请输入单价" bindblur='p_glass_p'/> </van-cell-group> </view> <view class="content-align-right"> <van-dropdown-menu> <van-dropdown-item value="{{ value10 }}" options="{{ option10 }}" bindchange="p_glass_price"/> </van-dropdown-menu> </view> </view>