uni app 微信小程序登录问题 getUserProfile
<blockquote><p>uni app 开发微信小程序发布后被拒绝了,是因为我用的是以前的微信登录方式<br>
4.13号后一定要来新的登录方式(<code>getUserProfile</code>)实现登录功能,否则腾讯被拒绝。<br>
<img src="https://img2020.cnblogs.com/blog/2205076/202104/2205076-20210417181036667-140826906.png" alt="" loading="lazy"></p>
</blockquote>
<h4 id="不需要以前那样什么open-type等等直接用click方法调用">不需要以前那样什么open-type等等;直接用<code>@click</code>方法调用</h4>
<p><code><button@click="newWxLogin">新登录</button></code></p>
<pre><code>newWxLogin(){
uni.getUserProfile({
desc:'登录',
success:(res)=>{
console.log(res);
},
fail:(err)=>{
console.log(err);
}
})
}
</code></pre>
<blockquote>
<p>可是我的报错了<code>uni.getUserProfile is not a function</code>是因为微信开发者工具设置错误<br>
解决方式:把微信开发者工具的本地设置版本设置为2.16.0即可<br>
<img src="https://img2020.cnblogs.com/blog/2205076/202104/2205076-20210417180532699-79878772.png" alt="" loading="lazy"></p>
</blockquote>
<h4 id="列子">列子:</h4>
<pre><code><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>
</code></pre><br><br>
来源:https://www.cnblogs.com/nurmemet/p/14671695.html
頁:
[1]