From 6a9f4c858d7d79a15ae1c5396bf56cdf074d9a56 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 30 Sep 2025 10:58:11 +0800 Subject: [PATCH] bugfix --- bricks/input.js | 16 ++++++++-------- bricks/videoplayer.js | 8 ++++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/bricks/input.js b/bricks/input.js index a0eba7d..bf3c895 100644 --- a/bricks/input.js +++ b/bricks/input.js @@ -485,17 +485,17 @@ bricks.UiFile = class extends bricks.VBox { this.dom_element.appendChild(this.input); } handleFileSelect(event){ + var files = []; + event.target.files.forEach(f => { + if (! this.accept || f.type.startsWith(this.accept)){ + files.push(f); + } + }); + if (files.length == 0) return; if (this.opts.multiple){ - files = []; - event.target.files.forEach(f => { - if (! this.accept || f.type.startsWith(this.accept)){ - files.push(f); - } - }); this.value = files; } else { - const file = event.target.files[0]; - this.value = file; + this.value = files[0]; } console.log('"changed" fired', this.value); this.dispatch('changed', this.getValue()); diff --git a/bricks/videoplayer.js b/bricks/videoplayer.js index eda4c77..c5851be 100644 --- a/bricks/videoplayer.js +++ b/bricks/videoplayer.js @@ -126,7 +126,9 @@ bricks.VideoPlayer = class extends bricks.VBox { bindEvents() { // 播放/暂停 - this.playPauseBtn.addEventListener('click', () => { + this.playPauseBtn.addEventListener('click', (e) => { + e.stopPropagation(); + e.preventDefault(); if (this.video.paused) { this.video.play(); } else { @@ -135,7 +137,9 @@ bricks.VideoPlayer = class extends bricks.VBox { }); // 静音切换 - this.muteBtn.addEventListener('click', () => { + this.muteBtn.addEventListener('click', (e) => { + e.stopPropagation(); + e.preventDefault(); this.video.muted = !this.video.muted; this.updateMuteUI(); });