vue中push报错的问题如何解决呢?
Admin 2022-09-13 群英技术资讯 1026 次浏览
当在当前页面中push页面跳转当前页,只是push的参数不同时,只能用字符串拼接,parames和query都不会起作用。不知道为什么。。。
比如说:当前页的url是
/invest/myinvest?page=1&day=0-30`
但是想点击的时候改变参数,所以就
this.$router.push({path:'/invest/myinvest?',query:{page:1,day:'0-30'}})
然而并无卵用。。。。
只能:
this.$router.push("/invest/myinvest?page="+currentPage+"&day="day);
axios.post('/processing/', {})
.then(function (response) {
console.log(response.data);
if (response.data == 'no_processing') {
alert("文章分析失败!");
return;
}else if(response.data=='empty_processing'){
alert("文章数据为空,无法分析!")
return;
}
response.data.forEach(function(element){
this.processing_tableData.push(element); //“push”报错
console.log(element);
});
console.log("ok_processing")
})
.catch(function (error) {
console.log(error);
})
报错:
TypeError: Cannot read property ‘push’ of undefined
在外部定义一个值指代Vue实例
var self = this; //外部定义
axios.post('/processing/', {})
.then(function (response) {
console.log(response.data);
if (response.data == 'no_processing') {
alert("文章分析失败!");
return;
}else if(response.data=='empty_processing'){
alert("文章数据为空,无法分析!")
return;
}
response.data.forEach(function(element){
self.processing_tableData.push(element); //把“this”=》“self”
console.log(element);
});
console.log("ok_processing")
})
.catch(function (error) {
console.log(error);
})
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
判断语句这个我们不陌生,就是判断是否满足指定的条件,如果满足则执行一定的代码,否则跳过,下面这篇文章主要给大家介绍了关于JavaScript中判断的优雅写法,需要的朋友可以参考下
这篇文章主要为大家详细介绍了原生JavaScript实现简单五子棋游戏,文中示例代码注释的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
JS中require方法怎样用?一些新手对于node.js中require方法不是很了解,对此这篇文章就主要给大家分享一下node.js中require方法以及加载规则,有着方面学习需求的朋友就接着看吧。
node服务CPU过高怎么办?怎么排查?下面本篇文章给大家整理分享下node服务CPU过高的排查思路,希望对大家有所帮助!
用javascript编程求水仙花数的方法:1、使用for循环查找遍历所有三位数;2、判断遍历的数字是否是各个位数的数字的3次幂数之和是否等于数字本身;3、分别选取个十百位上的数;4、用if语句判断i是否是水仙花数即可。
成为群英会员,开启智能安全云计算之旅
立即注册Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008