diff --git a/uni_modules/uni-id-pages/changelog.md b/uni_modules/uni-id-pages/changelog.md index bb8c7db75860fb6f1d2eb1cc31b71d765946a986..69697f40a8fd694dce4c52b42c89cf6eda7aaee2 100644 --- a/uni_modules/uni-id-pages/changelog.md +++ b/uni_modules/uni-id-pages/changelog.md @@ -1,3 +1,5 @@ +## 1.1.3(2023-02-13) +- 修复 非微信小程序端报`TypeError: uni.hideHomeButton is not a function`的问题 ## 1.1.2(2023-02-10) - 新增 微信小程序端 首页需强制登录时,隐藏返回首页按钮 - uni-id-co 新增 外部联登后修改用户信息接口(updateUserInfoByExternal) [文档](https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#external-update-userinfo) diff --git a/uni_modules/uni-id-pages/common/login-page.mixin.js b/uni_modules/uni-id-pages/common/login-page.mixin.js index cff4071e5071f8016e66d91cb2799b16dd888632..35e50302ca90e4120124a9438924d30b50e6312c 100644 --- a/uni_modules/uni-id-pages/common/login-page.mixin.js +++ b/uni_modules/uni-id-pages/common/login-page.mixin.js @@ -1,9 +1,8 @@ -import { - store, - mutations - } from '@/uni_modules/uni-id-pages/common/store.js' +import { + mutations +} from '@/uni_modules/uni-id-pages/common/store.js' import config from '@/uni_modules/uni-id-pages/config.js' -let mixin = { +const mixin = { data() { return { config, @@ -17,7 +16,7 @@ let mixin = { // #endif }, mounted() { - this.isMounted = true; + this.isMounted = true }, onLoad(e) { if (e.is_weixin_redirect) { @@ -25,12 +24,12 @@ let mixin = { mask: true }) - if( window.location.href.includes('#') ){ + if (window.location.href.includes('#')) { // 将url通过 ? 分割获取后面的参数字符串 再通过 & 将每一个参数单独分割出来 - let paramsArr = window.location.href.split('?')[1].split('&') - paramsArr.forEach(item=>{ - let arr = item.split('=') - if(arr[0] == 'code'){ + const paramsArr = window.location.href.split('?')[1].split('&') + paramsArr.forEach(item => { + const arr = item.split('=') + if (arr[0] == 'code') { e.code = arr[1] } }) @@ -38,19 +37,21 @@ let mixin = { this.$nextTick(n => { // console.log(this.$refs.uniFabLogin); this.$refs.uniFabLogin.login({ - code:e.code + code: e.code }, 'weixin') }) } if (e.uniIdRedirectUrl) { this.uniIdRedirectUrl = decodeURIComponent(e.uniIdRedirectUrl) - } - - if(getCurrentPages().length === 1){ - uni.hideHomeButton() - console.log('已隐藏:返回首页按钮'); - } + } + + // #ifdef MP-WEIXIN + if (getCurrentPages().length === 1) { + uni.hideHomeButton() + console.log('已隐藏:返回首页按钮'); + } + // #endif }, computed: { needAgreements() { @@ -90,4 +91,5 @@ let mixin = { } } } -export default mixin + +export default mixin