mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-22 21:31:20 -08:00
压缩字符
This commit is contained in:
1 parent
2df60a78ff
commit
5f40463713
40 files changed
+385
-481
No files matched your search
@@ -1,6 +1,4 @@
|
||||
import { hasClass, addClass, removeClass, append, setStyle, setStyles, tooltip } from './dom';
|
||||
import { has, def } from './property';
|
||||
import { errorHandle } from './error';
|
||||
import { hasClass, addClass, removeClass, append, setStyles, tooltip } from './dom';
|
||||
|
||||
export default class Component {
|
||||
constructor(art) {
|
||||
@@ -15,7 +13,6 @@ export default class Component {
|
||||
}
|
||||
|
||||
set show(value) {
|
||||
errorHandle(value === false || value === true, 'The show attribute expects a boolean value');
|
||||
const { $player } = this.art.template;
|
||||
const className = `art-${this.name}-show`;
|
||||
if (value) {
|
||||
@@ -32,10 +29,9 @@ export default class Component {
|
||||
|
||||
add(getOption, callback) {
|
||||
const option = typeof getOption === 'function' ? getOption(this.art) : getOption;
|
||||
if (!this.$parent || option.disable) return {};
|
||||
if (!this.$parent || option.disable) return;
|
||||
this.id += 1;
|
||||
const name = option.name || `${this.name}${this.id}`;
|
||||
errorHandle(!has(this, name), `Cannot add a component that already has the same name: ${name}`);
|
||||
const $ref = document.createElement('div');
|
||||
$ref.classList.value = `art-${this.name} art-${this.name}-${name}`;
|
||||
|
||||
@@ -75,22 +71,6 @@ export default class Component {
|
||||
callback($ref, this, this.art);
|
||||
}
|
||||
|
||||
def(this, name, {
|
||||
value: {
|
||||
get $ref() {
|
||||
return $ref;
|
||||
},
|
||||
set show(value) {
|
||||
if (value) {
|
||||
setStyle($ref, 'display', 'block');
|
||||
} else {
|
||||
setStyle($ref, 'display', 'none');
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
this.art.emit(`${this.name}:add`, option);
|
||||
return this[name];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user