This commit is contained in:
yumoqing 2025-09-30 10:58:11 +08:00
parent bff0557fed
commit 6a9f4c858d
2 changed files with 14 additions and 10 deletions

View File

@ -485,17 +485,17 @@ bricks.UiFile = class extends bricks.VBox {
this.dom_element.appendChild(this.input); this.dom_element.appendChild(this.input);
} }
handleFileSelect(event){ 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){ if (this.opts.multiple){
files = [];
event.target.files.forEach(f => {
if (! this.accept || f.type.startsWith(this.accept)){
files.push(f);
}
});
this.value = files; this.value = files;
} else { } else {
const file = event.target.files[0]; this.value = files[0];
this.value = file;
} }
console.log('"changed" fired', this.value); console.log('"changed" fired', this.value);
this.dispatch('changed', this.getValue()); this.dispatch('changed', this.getValue());

View File

@ -126,7 +126,9 @@ bricks.VideoPlayer = class extends bricks.VBox {
bindEvents() { bindEvents() {
// 播放/暂停 // 播放/暂停
this.playPauseBtn.addEventListener('click', () => { this.playPauseBtn.addEventListener('click', (e) => {
e.stopPropagation();
e.preventDefault();
if (this.video.paused) { if (this.video.paused) {
this.video.play(); this.video.play();
} else { } 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.video.muted = !this.video.muted;
this.updateMuteUI(); this.updateMuteUI();
}); });