提交 978acb87 编写于 作者: DCloud_JSON's avatar DCloud_JSON 提交者: chenruilong

修复 非微信小程序端报`TypeError: uni.hideHomeButton is not a function`的问题

上级 140b2742
## 1.1.3(2023-02-13)
- 修复 非微信小程序端报`TypeError: uni.hideHomeButton is not a function`的问题
## 1.1.2(2023-02-10) ## 1.1.2(2023-02-10)
- 新增 微信小程序端 首页需强制登录时,隐藏返回首页按钮 - 新增 微信小程序端 首页需强制登录时,隐藏返回首页按钮
- uni-id-co 新增 外部联登后修改用户信息接口(updateUserInfoByExternal) [文档](https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#external-update-userinfo) - uni-id-co 新增 外部联登后修改用户信息接口(updateUserInfoByExternal) [文档](https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#external-update-userinfo)
......
import { import {
store, mutations
mutations } from '@/uni_modules/uni-id-pages/common/store.js'
} from '@/uni_modules/uni-id-pages/common/store.js'
import config from '@/uni_modules/uni-id-pages/config.js' import config from '@/uni_modules/uni-id-pages/config.js'
let mixin = { const mixin = {
data() { data() {
return { return {
config, config,
...@@ -17,7 +16,7 @@ let mixin = { ...@@ -17,7 +16,7 @@ let mixin = {
// #endif // #endif
}, },
mounted() { mounted() {
this.isMounted = true; this.isMounted = true
}, },
onLoad(e) { onLoad(e) {
if (e.is_weixin_redirect) { if (e.is_weixin_redirect) {
...@@ -25,12 +24,12 @@ let mixin = { ...@@ -25,12 +24,12 @@ let mixin = {
mask: true mask: true
}) })
if( window.location.href.includes('#') ){ if (window.location.href.includes('#')) {
// 将url通过 ? 分割获取后面的参数字符串 再通过 & 将每一个参数单独分割出来 // 将url通过 ? 分割获取后面的参数字符串 再通过 & 将每一个参数单独分割出来
let paramsArr = window.location.href.split('?')[1].split('&') const paramsArr = window.location.href.split('?')[1].split('&')
paramsArr.forEach(item=>{ paramsArr.forEach(item => {
let arr = item.split('=') const arr = item.split('=')
if(arr[0] == 'code'){ if (arr[0] == 'code') {
e.code = arr[1] e.code = arr[1]
} }
}) })
...@@ -38,19 +37,21 @@ let mixin = { ...@@ -38,19 +37,21 @@ let mixin = {
this.$nextTick(n => { this.$nextTick(n => {
// console.log(this.$refs.uniFabLogin); // console.log(this.$refs.uniFabLogin);
this.$refs.uniFabLogin.login({ this.$refs.uniFabLogin.login({
code:e.code code: e.code
}, 'weixin') }, 'weixin')
}) })
} }
if (e.uniIdRedirectUrl) { if (e.uniIdRedirectUrl) {
this.uniIdRedirectUrl = decodeURIComponent(e.uniIdRedirectUrl) this.uniIdRedirectUrl = decodeURIComponent(e.uniIdRedirectUrl)
} }
if(getCurrentPages().length === 1){ // #ifdef MP-WEIXIN
uni.hideHomeButton() if (getCurrentPages().length === 1) {
console.log('已隐藏:返回首页按钮'); uni.hideHomeButton()
} console.log('已隐藏:返回首页按钮');
}
// #endif
}, },
computed: { computed: {
needAgreements() { needAgreements() {
...@@ -90,4 +91,5 @@ let mixin = { ...@@ -90,4 +91,5 @@ let mixin = {
} }
} }
} }
export default mixin
export default mixin
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册