mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-18 19:01:20 -08:00
fix demo
This commit is contained in:
1 parent
737b667c1b
commit
0aeb1262db
5 files changed
+2
-155
No files matched your search
@@ -1,4 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 48 48">
|
||||
<path d="M0 0h48v48H0z" fill="none"/>
|
||||
<path d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 303 B |
@@ -283,88 +283,6 @@ export default class Setting extends Component {
|
||||
return $item;
|
||||
}
|
||||
|
||||
creatSwitch(item) {
|
||||
const {
|
||||
icons,
|
||||
events: { proxy },
|
||||
} = this.art;
|
||||
|
||||
const $item = document.createElement('div');
|
||||
addClass($item, 'art-setting-item');
|
||||
|
||||
const $left = append($item, '<div class="art-setting-item-left"></div>');
|
||||
const $right = append($item, '<div class="art-setting-item-right"></div>');
|
||||
|
||||
const $icon = document.createElement('div');
|
||||
addClass($icon, 'art-setting-item-left-icon');
|
||||
append($icon, item.icon || icons.config);
|
||||
append($left, $icon);
|
||||
|
||||
item._$icon = $icon;
|
||||
|
||||
def(item, 'icon', {
|
||||
get() {
|
||||
return $icon.innerHTML;
|
||||
},
|
||||
set(value) {
|
||||
if (typeof value === 'string' || typeof value === 'number') {
|
||||
$icon.innerHTML = value;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const $html = document.createElement('div');
|
||||
addClass($html, 'art-setting-item-left-text');
|
||||
append($html, item.html || '');
|
||||
append($left, $html);
|
||||
item._$html = $html;
|
||||
|
||||
def(item, 'html', {
|
||||
get() {
|
||||
return $html.innerHTML;
|
||||
},
|
||||
set(value) {
|
||||
if (typeof value === 'string' || typeof value === 'number') {
|
||||
$html.innerHTML = value;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const $switch = document.createElement('div');
|
||||
addClass($switch, 'art-setting-item-right-icon');
|
||||
const $switchOn = append($switch, icons.switchOn);
|
||||
const $switchOff = append($switch, icons.switchOff);
|
||||
setStyle(item.switch ? $switchOff : $switchOn, 'display', 'none');
|
||||
append($right, $switch);
|
||||
item._$switch = item.switch;
|
||||
|
||||
def(item, 'switch', {
|
||||
get() {
|
||||
return item._$switch;
|
||||
},
|
||||
set(value) {
|
||||
item._$switch = value;
|
||||
if (value) {
|
||||
setStyle($switchOff, 'display', 'none');
|
||||
setStyle($switchOn, 'display', null);
|
||||
} else {
|
||||
setStyle($switchOff, 'display', null);
|
||||
setStyle($switchOn, 'display', 'none');
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const event = proxy($item, 'click', async (event) => {
|
||||
if (item.onSwitch) {
|
||||
item.switch = await item.onSwitch.call(this.art, item, $item, event);
|
||||
}
|
||||
});
|
||||
|
||||
this.events.push(event);
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
init(option, width) {
|
||||
const { constructor } = this.art;
|
||||
|
||||
|
||||
Reference in new issue
Block a user