uni app 微信小程序登录问题 getUserProfile

uni app 开发微信小程序发布后被拒绝了,是因为我用的是以前的微信登录方式
4.13号后一定要来新的登录方式(getUserProfile)实现登录功能,否则腾讯被拒绝。

不需要以前那样什么open-type等等;直接用@click方法调用

<button @click="newWxLogin">新登录</button>

  newWxLogin(){
    uni.getUserProfile({
        desc:'登录',
        success:(res)=>{
	     console.log(res);
	},
	fail:(err)=>{
	     console.log(err);
        }
    })
 }

可是我的报错了uni.getUserProfile is not a function是因为微信开发者工具设置错误
解决方式:把微信开发者工具的本地设置版本设置为2.16.0即可

列子:

<template>
	<view style="padding-top: 100upx;">
		<button  @click="newWxLogin">新登录</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			newWxLogin(){
				uni.getUserProfile({
					desc:'登录',
					success:(res)=>{
						console.log(res);
					},
					fail:(err)=>{
						console.log(err);
					}
				})
			}
		}
	}
</script>

<style>


</style>

posted @ 2021-04-17 18:12  nur01  阅读(8663)  评论(0编辑  收藏  举报