mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-14 16:36:18 -08:00
调整选择器参数
This commit is contained in:
1 parent
c621687988
commit
53d2f12ab6
8 files changed
+45
-70
No files matched your search
@@ -773,16 +773,6 @@
|
||||
name: 'string',
|
||||
url: 'string'
|
||||
}],
|
||||
switcher: [{
|
||||
index: 'number|undefined',
|
||||
click: 'function|undefined',
|
||||
name: 'string|undefined',
|
||||
default: 'string|undefined',
|
||||
list: [{
|
||||
name: 'string',
|
||||
text: 'string'
|
||||
}]
|
||||
}],
|
||||
highlight: [{
|
||||
time: 'number',
|
||||
text: 'string'
|
||||
@@ -2374,24 +2364,16 @@
|
||||
});
|
||||
}
|
||||
|
||||
if (option.mounted) {
|
||||
option.mounted.call(this.art, $ref);
|
||||
}
|
||||
|
||||
if (['left', 'right'].includes(option.position)) {
|
||||
if (!($ref.firstElementChild && $ref.firstElementChild.tagName === 'I')) {
|
||||
addClass($ref, 'art-control-onlyText');
|
||||
}
|
||||
|
||||
if (option.selector) {
|
||||
addClass($ref, 'art-control-selector');
|
||||
var $value = document.createElement('div');
|
||||
$value.classList.value = "art-selector-value";
|
||||
append($value, option.html);
|
||||
$ref.innerHTML = '';
|
||||
$ref.innerText = '';
|
||||
append($ref, $value);
|
||||
var list = option.selector.map(function (item) {
|
||||
return "<div class=\"art-selector-item\">".concat(item, "</div>");
|
||||
return "<div class=\"art-selector-item\">".concat(item.name, "</div>");
|
||||
}).join('');
|
||||
var $list = document.createElement('div');
|
||||
addClass($list, 'art-selector-list');
|
||||
@@ -2405,17 +2387,28 @@
|
||||
hover($ref, setLeft);
|
||||
proxy($ref, 'click', function (event) {
|
||||
if (hasClass(event.target, 'art-selector-item')) {
|
||||
var html = event.target.innerHTML;
|
||||
$value.innerHTML = html;
|
||||
var _name = event.target.innerText;
|
||||
var find = option.selector.find(function (item) {
|
||||
return item.name === _name;
|
||||
});
|
||||
$value.innerText = _name;
|
||||
setLeft();
|
||||
|
||||
if (option.onSelect) {
|
||||
option.onSelect.call(_this.art, event, html);
|
||||
if (option.onSelect && find) {
|
||||
option.onSelect.call(_this.art, find.value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (option.mounted) {
|
||||
option.mounted.call(this.art, $ref);
|
||||
}
|
||||
|
||||
if (!($ref.firstElementChild && $ref.firstElementChild.tagName === 'I')) {
|
||||
addClass($ref, 'art-control-onlyText');
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "show",
|
||||
|
||||
Reference in new issue
Block a user