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>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM