bugfix: 取消onetap
This commit is contained in:
3
env.d.ts
vendored
3
env.d.ts
vendored
@@ -8,8 +8,10 @@ interface GoogleAccounts {
|
||||
client_id: string
|
||||
auto_select?: boolean
|
||||
callback: (response: { credential: string }) => void
|
||||
context?: 'signin' | 'signup' | 'use'
|
||||
ux_mode?: 'popup' | 'redirect'
|
||||
itp_support?: boolean
|
||||
cancel_on_tap_outside?: boolean
|
||||
}) => void
|
||||
renderButton: (element: Element | null, config: {
|
||||
type?: 'standard' | 'icon'
|
||||
@@ -18,6 +20,7 @@ interface GoogleAccounts {
|
||||
size?: 'large' | 'medium' | 'small'
|
||||
logo_alignment?: 'left' | 'center'
|
||||
}) => void
|
||||
disableAutoSelect?: () => void
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,15 +56,17 @@ const createGmailLogin = async () => {
|
||||
script.src = data.scriptSrc
|
||||
})
|
||||
}
|
||||
window.google.accounts.id.initialize({
|
||||
// 主要就是填写client_id
|
||||
// 初始化Google登录,禁用One Tap自动提示
|
||||
const initConfig: Parameters<typeof window.google.accounts.id.initialize>[0] = {
|
||||
client_id: GOOGLE_CLIENT_ID,
|
||||
auto_select: false,
|
||||
auto_select: false, // 禁用自动选择,避免显示One Tap提示
|
||||
callback: handleCredentialResponse,
|
||||
// context:"signin",
|
||||
context: 'signin', // 设置为signin模式,避免显示个性化One Tap提示
|
||||
ux_mode: 'popup',
|
||||
itp_support: true
|
||||
})
|
||||
itp_support: true,
|
||||
cancel_on_tap_outside: true // 点击外部时取消One Tap提示
|
||||
}
|
||||
window.google.accounts.id.initialize(initConfig as any)
|
||||
console.log('创建谷歌登录按钮:', document.querySelector('.Container #g_id_signin'))
|
||||
window.google.accounts.id.renderButton(document.querySelector('.Container #g_id_signin'), {
|
||||
type: 'standard', //icon为只有一个icon
|
||||
|
||||
Reference in New Issue
Block a user