index.vue 860 B

12345678910111213141516171819202122232425262728
  1. <script setup>
  2. const emit = defineEmits(['success', 'error'])
  3. const { loading, onGoogleLogin } = useGoogleLogin()
  4. async function googleLogin() {
  5. try {
  6. const result = await onGoogleLogin()
  7. console.log('登陆成功后------222')
  8. emit('success', result)
  9. }
  10. catch (error) {
  11. emit('error', error)
  12. }
  13. }
  14. </script>
  15. <template>
  16. <button id="google-login-button" class="b-rd-200px w-100% bg-#fff text-#333 b-1px b-solid b-#D8D8D8 h-48px lh-48px hover:b-#9B6CFF disabled:hover:b-#D8D8D8 cursor-pointer mb-24px text-14px fw-500" :disabled="loading" @click="googleLogin">
  17. <span v-if="loading">登录中...</span>
  18. <div v-else class="flex justify-center items-center">
  19. <img src="@/assets/images/google_logo.png" alt="" class="w-24px h-24px mr-10px">
  20. Continue with Google
  21. </div>
  22. </button>
  23. </template>
  24. <style scoped>
  25. </style>