1
0
mirror of https://github.com/LibreTranslate/LibreTranslate.git synced 2024-12-18 08:27:03 +02:00

Merge pull request #99 from pierotofy/selectfix

Set selected attributes
This commit is contained in:
Piero Toffanin 2021-06-12 11:32:09 -04:00 committed by GitHub
commit 4418a1c4b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -336,6 +336,18 @@
this.inputText = this.inputText.substring(0, this.charactersLimit); this.inputText = this.inputText.substring(0, this.charactersLimit);
} }
// Update "selected" attribute (to overcome a vue.js limitation)
// but properly display checkmarks on supported browsers
for (var i = 0; i < this.$refs.sourceLangDropdown.children.length; i++){
var el = this.$refs.sourceLangDropdown.children[i];
if (el.value === this.sourceLang) el.setAttribute('selected', '');
else el.removeAttribute('selected');
}
for (var i = 0; i < this.$refs.targetLangDropdown.children.length; i++){
var el = this.$refs.targetLangDropdown.children[i];
if (el.value === this.targetLang) el.setAttribute('selected', '');
else el.removeAttribute('selected');
}
}, },
computed: { computed: {
requestCode: function(){ requestCode: function(){