Skip to content

Commit

Permalink
fix(react,vue2,vue3): 🐛 issue#78
Browse files Browse the repository at this point in the history
  • Loading branch information
i7eo committed Nov 16, 2023
1 parent 8ff12e6 commit 6ad916e
Show file tree
Hide file tree
Showing 4 changed files with 1,801 additions and 1,851 deletions.
7 changes: 7 additions & 0 deletions .changeset/selfish-monkeys-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@google-translate-select/vue2': patch
'@google-translate-select/vue3': patch
'@google-translate-select/react': patch
---

bump version for PR
13 changes: 5 additions & 8 deletions packages/vue2/src/google-translate-select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -306,21 +306,18 @@ export default Vue.extend<
* @param select
*/
triggerTranslate(select: HTMLSelectElement | string) {
if (!select) return
let selectValue = ''
if (isString(select)) {
selectValue = select
} else {
selectValue = select.value ?? ''
if (!select) {
return
}
const selectValue = isString(select) ? select : select.value ?? ''
const googleTranslateOriginalSelectEl = document.querySelector(
GOOGLE_TRANSLATE_ORIGINAL_SELECT_CLASSNAME
) as HTMLSelectElement
) as HTMLSelectElement | null
const googleTranslateSelectEl = document.querySelector(`.${ns.b()}`)
if (
!googleTranslateSelectEl ||
!googleTranslateOriginalSelectEl ||
googleTranslateSelectEl.innerHTML.length === 0 ||
googleTranslateOriginalSelectEl.options.length === 0
) {
Expand Down
14 changes: 5 additions & 9 deletions packages/vue3/src/google-translate-select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -262,22 +262,18 @@ export default defineComponent({
* @param select
*/
function triggerTranslate(select: HTMLSelectElement | string) {
if (!select) return
let selectValue = ''
if (isString(select)) {
selectValue = select
} else {
selectValue = select.value ?? ''
if (!select) {
return
}
const selectValue = isString(select) ? select : select.value ?? ''
const googleTranslateOriginalSelectEl = document.querySelector(
GOOGLE_TRANSLATE_ORIGINAL_SELECT_CLASSNAME
) as HTMLSelectElement
) as HTMLSelectElement | null
const googleTranslateSelectEl = document.querySelector(`.${ns.b()}`)
if (
!googleTranslateSelectEl ||
!googleTranslateOriginalSelectEl ||
googleTranslateSelectEl.innerHTML.length === 0 ||
googleTranslateOriginalSelectEl.options.length === 0
) {
Expand Down
Loading

1 comment on commit 6ad916e

@vercel
Copy link

@vercel vercel bot commented on 6ad916e Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.