mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 08:01:20 -08:00
添加更多设置项
This commit is contained in:
1 parent
0bc9c88af2
commit
f6295c1fbc
6 files changed
+149
-9
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import { inverseClass } from '../utils';
|
||||
|
||||
export default function aspectRatio(settingOption) {
|
||||
return art => {
|
||||
const { i18n, player } = art;
|
||||
return {
|
||||
...settingOption,
|
||||
html: `
|
||||
<div class="art-setting-header">${i18n.get('Aspect ratio')}</div>
|
||||
<div class="art-setting-radio">
|
||||
<div class="art-radio-item current">
|
||||
<button type="button" data-value="default">${i18n.get('Default')}</button>
|
||||
</div>
|
||||
<div class="art-radio-item">
|
||||
<button type="button" data-value="4:3">4:3</button>
|
||||
</div>
|
||||
<div class="art-radio-item">
|
||||
<button type="button" data-value="16:9">16:9</button>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
click: event => {
|
||||
const { value } = event.target.dataset;
|
||||
if (value) {
|
||||
player.aspectRatio(value);
|
||||
}
|
||||
},
|
||||
mounted: $setting => {
|
||||
art.on('aspectRatioChange', ratio => {
|
||||
const $current = Array.from($setting.querySelectorAll('button')).find(
|
||||
item => item.dataset.value === ratio,
|
||||
);
|
||||
inverseClass($current.parentElement, 'current');
|
||||
});
|
||||
},
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user