uniapp 在函数里面调用一个函数,报undefined.

这是因为this的指向问题,把this赋给一个变量就可以了。小问题记录一下

clickLogout:function(){
				let _this = this;
				_this.$showModal({
					title:"",
					content:"确定退出登录?",
					showCancel:true,
					success:function(res){
						if(res.confirm){
							//uni.clearStorage();
							_this.$clearStorage();
							uni.navigateTo({
								url:'/pages/login/login'
							})
							
						}
					},
					
				})
			},
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐