详细问题描述
(DCloud产品不会有明显的bug,所以你遇到的问题大都是在特定环境下才能重现的问题,请仔细描述你的环境和重现方式,否则DCloud很难排查解决你的问题)
[内容]
//选项卡点击事件
clickitem(idx, val, cat_id) {
console.log("duan 1")
let thatquery = uni.createSelectorQuery().in(this).select(".pushlist");
console.log("duan 2")
thatquery.fields({
size: true,
rect: true
}, data => {
console.log("duan 3")
this.activeitemindex = idx
this.page = 0
this.show_loading_bar = false
this.article_cat_id = cat_id
if (data.top > 50) {
uni.pageScrollTo({
scrollTop: uni.upx2px(856),
duration: 300
});
var _this = this
setTimeout(function() {
_this.loadActive()
}, 360);
} else {
uni.pageScrollTo({
scrollTop: uni.upx2px(856),
duration: 0
});
this.loadActive()
}
}).exec();
console.log("duan 4")
},
重现步骤
App端第一次调用该方法正常,第二次调用时保存 h.push is not a function,
[结果]
10:57:02.896 duan 1 at pages\tabBar\index\index.vue:506
10:57:02.916 duan 2 at pages\tabBar\index\index.vue:508
10:57:02.936 duan 4 at pages\tabBar\index\index.vue:538
10:57:02.956 duan 3 at pages\tabBar\index\index.vue:513
10:57:04.478 push1 at pages\tabBar\index\index.vue:578
10:57:04.498 at pages\tabBar\index\index.vue:579
10:57:04.518 push1 at pages\tabBar\index\index.vue:578
10:57:04.538 at pages\tabBar\index\index.vue:579
10:57:04.558 push1 at pages\tabBar\index\index.vue:578
10:57:04.578 at pages\tabBar\index\index.vue:579
10:57:05.922 duan 1 at pages\tabBar\index\index.vue:506
10:57:05.944 duan 2 at pages\tabBar\index\index.vue:508
10:57:05.962 duan 4 at pages\tabBar\index\index.vue:538
10:57:05.982 TypeError: h.push is not a function
10:57:06.003 at Object.addFetchInfo (uniapp://ready:182:635944)
10:57:06.022 at uniapp://ready:182:637155
10:57:06.042 at t.(anonymous function) (uniapp://ready:182:89683)
10:57:06.062 at Object.subscribeHandler (uniapp://ready:182:1513)
10:57:06.082 at Object.subscribeHandler (uniapp://ready:1:20407)
10:57:06.122 webviewScriptError
10:57:06.142 h.push is not a function
10:57:06.162 TypeError: h.push is not a function
10:57:06.182 at Object.addFetchInfo (uniapp://ready:182:635944)
10:57:06.202 at uniapp://ready:182:637155
10:57:06.222 at t.(anonymous function) (uniapp://ready:182:89683)
10:57:06.242 at Object.subscribeHandler (uniapp://ready:182:1513)
10:57:06.262 at Object.subscribeHandler (uniapp://ready:1:20407)
10:57:06.302 Uncaught TypeError: h.push is not a function at uniapp://ready:182
IDE运行环境说明
HBuilderX
win 7
小程序正常 app报错
HBuilderX构建项目
自定义组件模式
App运行环境说明
[Android版本号]
8.0.0
附件
[IDE问题请提供HBuilderX运行日志。菜单帮助-查看运行日志,点右键打开文件所在目录,将log文件压缩成zip包上传]
[App问题请提供可重现问题的代码片段,你补充的细一点,问题就解决的快一点]
[App安装包或H5地址]
[可重现代码片段]
联系方式
[QQ]
2246585559
8 个回复
六狱 (作者) - Phper
dd 怎么没人
六狱 (作者) - Phper
dd
来人啊
六狱 (作者) - Phper
问题出现在uni.pageScrollTo()中,但还是不知道是怎么回事
1***@qq.com - MMM
同样的问题,怎么解决?官方也不管?
陈晨1
方便给一份可以复现的示例代码压缩包吗?
3***@qq.com
clickComment() {
if(this.conText.comment_count > 0) {
uni.createSelectorQuery().in(this).select('.article-comment').boundingClientRect((res) => {
if (res) {
let top = res.top + this.scrollTop;
uni.pageScrollTo({
scrollTop: top
})
}
}).exec()
}
},
这个方法在APP端第二次点击会报错 我今天也遇到了同样问题
2019-11-28 17:50
3***@qq.com
17:48:22.887 TypeError: h.push is not a function
17:48:22.908 at Object.addFetchInfo (uniapp://ready:182:636455)
17:48:22.928 at uniapp://ready:182:637666
17:48:22.948 at t.(anonymous function) (uniapp://ready:182:89683)
17:48:22.969 at Object.subscribeHandler (uniapp://ready:182:1513)
17:48:22.990 at Object.A [as subscribeHandler] (uniapp://ready:1:8953)
17:48:23.031 webviewScriptError
17:48:23.052 h.push is not a function
17:48:23.073 TypeError: h.push is not a function
17:48:23.093 at Object.addFetchInfo (uniapp://ready:182:636455)
17:48:23.114 at uniapp://ready:182:637666
17:48:23.134 at t.(anonymous function) (uniapp://ready:182:89683)
17:48:23.155 at Object.subscribeHandler (uniapp://ready:182:1513)
17:48:23.175 at Object.A [as subscribeHandler] (uniapp://ready:1:8953)
17:48:23.216 Uncaught TypeError: h.push is not a function at uniapp://ready:182
2019-11-28 17:50
CJ7235 - 前端爱好者
同样的问题,怎么解决?官方也不管?
DCloud_UNI_CHB
楼上小哥哥不是已经在求示例代码了嘛,你帮忙提供一个?
2019-11-14 17:53
众汇联创
回复 DCloud_UNI_CHB: 同样的问题,uni.pageScrollTo的duration设置0不报错,设置200就报错。所以现在解决没解决?楼上已经有代码了吧
2020-03-02 10:44
狮子大人
回复 DCloud_UNI_CHB: 同样的问题,不知道官方有没有找到原因
2020-03-10 09:49
1***@163.com
2020年5月9日,这个问题还未解决
DCloud_UNI_HT
楼上的代码片段,看不出来具体问题,需要提供一个可正常运行且能复现问题demo
2020-05-11 13:07
1***@163.com
回复 DCloud_UNI_HT: 这个有点奇怪,我今天在项目里添加一个单纯静态数据的demo,获取节点,然后调转指定节点完全没有问题。但是回到具体我原来的动态加载数据的页面却又会出现‘h.push is not a function’的问题,应该不单纯是获取节点的问题,我的页面东西太多了抽不出一个能重现问题的demo来~
主要标签部分:
<block v-for="(item, index) in record" :key="index">
<view v-if="item.hpid==me_info.userid&&index>0">
<view class="time_box">
<text class="time">{{item.htime}}</text> </view>
<view class="tj_box lay-row">
<view class="tj_infor my_infor lay-column">
<text>{{item.hmark==''?item.m:item.hmark}}<text class="red" v-if="item.money_show=='1'">¥{{item.hmoney}}</text></text>
<image class="arrow_r" src="/play/image/triangle_icon.png"></image>
</view>
<view v-if="info.headimgurl!=null">
<image class="user_img" v-if="me_info.headimgurl[0]!='/'" :src="me_info.headimgurl"></image>
<image class="user_img" v-else :src="(serviceUrl+me_info.headimgurl)"></image>
</view>
</view>
</view>
<view v-if="item.hpid!=taojiu_info.s_uid&&index>0">
<view class="time_box">
<text class="time">{{item.htime}}</text>
</view>
<view class="tj_box lay-row start">
<view v-if="info.headimgurl!=null">
<image class="user_img" v-if="info.headimgurl[0]!='/'" :src="info.headimgurl"></image>
<image class="user_img" v-else :src="(serviceUrl+info.headimgurl)"></image>
</view>
<view class="other_infor lay-column">
<view class="tj_infor">
<text>{{item.hmark==''?item.m:item.hmark}}<text class="red" v-if="item.money_show=='1'">¥{{item.hmoney}}</text></text>
<image class="arrow_r" src="/play/image/triangle_icon_02.png"></image>
</view>
</view>
</view>
</view>
</block>
<view id="query_foot"></view><!--要获取的id值query_foot,位于页面底部-->
js方法:
//滚动到当前文档最新的底部位置
gotoQueryFootId_Now:function(){
var query_foot = '';
//#ifdef MP-ALIPAY
query_foot = uni.createSelectorQuery();
//#endif
//#ifdef APP-PLUS || MP-WEIXIN || H5
query_foot = uni.createSelectorQuery().in(that);
//#endif
2020-05-13 14:45
DCloud_UNI_HT
不要贴代码,上传一个可运行的demo ,光看代码,不好确定问题