mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 17:51:20 -08:00
update
This commit is contained in:
1 parent
21228216f9
commit
814a02d14a
6 files changed
+48
-19
No files matched your search
@@ -35,9 +35,22 @@ export default class Setting extends Component {
|
||||
this.name = 'setting';
|
||||
this.$parent = $setting;
|
||||
this.events = [];
|
||||
this.option = [];
|
||||
|
||||
if (option.setting) {
|
||||
this.option = makeRecursion([playbackRate(art), aspectRatio(art), flip(art)]);
|
||||
if (option.playbackRate) {
|
||||
this.option.push(playbackRate(art));
|
||||
}
|
||||
|
||||
if (option.aspectRatio) {
|
||||
this.option.push(aspectRatio(art));
|
||||
}
|
||||
|
||||
if (option.flip) {
|
||||
this.option.push(flip(art));
|
||||
}
|
||||
|
||||
this.option = makeRecursion(this.option);
|
||||
|
||||
art.once('ready', () => {
|
||||
this.init(this.option);
|
||||
@@ -51,18 +64,18 @@ export default class Setting extends Component {
|
||||
}
|
||||
|
||||
creatItem(item, option) {
|
||||
const { icons } = this.art;
|
||||
const hasItems = item.items && item.items.length;
|
||||
|
||||
const $item = document.createElement('div');
|
||||
const $left = append($item, `<div class="art-setting-item-left"></div>`);
|
||||
const $right = append($item, `<div class="art-setting-item-right"></div>`);
|
||||
|
||||
const { icons } = this.art;
|
||||
addClass($item, 'art-setting-item');
|
||||
const hasItems = item.items && item.items.length;
|
||||
|
||||
if (item.current && !hasItems) {
|
||||
addClass($item, 'art-current');
|
||||
}
|
||||
|
||||
const $left = append($item, `<div class="art-setting-item-left"></div>`);
|
||||
|
||||
if (item.goBack) {
|
||||
append($left, icons.arrowLeft);
|
||||
addClass($item, 'art-setting-item-back');
|
||||
@@ -76,8 +89,6 @@ export default class Setting extends Component {
|
||||
|
||||
append($left, item.html);
|
||||
|
||||
const $right = append($item, `<div class="art-setting-item-right"></div>`);
|
||||
|
||||
if (hasItems && !item.goBack) {
|
||||
append($right, icons.arrowRight);
|
||||
}
|
||||
@@ -107,8 +118,8 @@ export default class Setting extends Component {
|
||||
return $item;
|
||||
}
|
||||
|
||||
add(item) {
|
||||
this.option.push(item);
|
||||
add(callback) {
|
||||
this.option.push(callback(this.art));
|
||||
this.option = makeRecursion(this.option);
|
||||
this.init(this.option);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user