mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 18:41:20 -08:00
update setting
This commit is contained in:
1 parent
7976cc42fe
commit
0616d944c5
7 files changed
+100
-27
No files matched your search
@@ -1,29 +1,36 @@
|
||||
import { inverseClass, queryAll } from '../utils';
|
||||
import { inverseClass, query, queryAll } from '../utils';
|
||||
|
||||
export default function aspectRatio(art) {
|
||||
const { i18n, icons } = art;
|
||||
|
||||
console.log(art.aspectRatio);
|
||||
function getI18n(value) {
|
||||
return value === 'default' ? i18n.get('Default') : value;
|
||||
}
|
||||
|
||||
return {
|
||||
width: 150,
|
||||
html: i18n.get('Aspect Ratio'),
|
||||
icon: icons.aspectRatio,
|
||||
desc: getI18n(art.aspectRatio),
|
||||
selector: ['default', '4:3', '16:9'].map((item) => {
|
||||
return {
|
||||
value: item,
|
||||
default: item === art.aspectRatio,
|
||||
html: item === 'default' ? i18n.get('Default') : item,
|
||||
html: getI18n(item),
|
||||
};
|
||||
}),
|
||||
onSelect(item) {
|
||||
art.aspectRatio = item.value;
|
||||
},
|
||||
mounted: ($panel) => {
|
||||
mounted: ($panel, item) => {
|
||||
const $desc = query('.art-setting-item-right-desc', item.$item);
|
||||
$desc.innerText = getI18n(art.aspectRatio);
|
||||
|
||||
art.on('aspectRatio', (value) => {
|
||||
const $current = queryAll('.art-setting-item', $panel).find((item) => item.dataset.value === value);
|
||||
if ($current) {
|
||||
inverseClass($current, 'art-current');
|
||||
$desc.innerText = getI18n(art.aspectRatio);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user