add dropdown component

This commit is contained in:
tsanie committed 2023-03-31 17:35:36 +08:00
1 parent b9447997fe
commit 41b1bbd7d6
20 files changed
+575 -74

No files matched your search

+3 -7
View File
@@ -66,6 +66,7 @@ async function refreshLgres(template, lgres) {
Object.defineProperty(lgres, 'r', {
writable: false,
configurable: false,
enumerable: false,
value: function (key, defaultValue) {
return getLanguage(this, key, defaultValue);
}
@@ -76,16 +77,11 @@ async function refreshLgres(template, lgres) {
function getLanguage(lgres, key, defaultValue) {
let value = lgres[key];
if (value == null) {
value = defaultValue;
}
return value;
return value ?? defaultValue;
}
function applyLanguage(dom, result) {
if (dom == null) {
dom = document.body;
}
dom ??= document.body;
for (let text of dom.querySelectorAll('[data-lgid]')) {
const key = text.getAttribute('data-lgid');
if (text.tagName === 'INPUT') {