mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-21 21:01:20 -08:00
验证重名组件
This commit is contained in:
1 parent
73e58d356e
commit
899307696b
4 files changed
+19
-9
No files matched your search
@@ -1,9 +1,10 @@
|
||||
import { append, setStyles, setStyle, remove } from './index';
|
||||
import { append, setStyles, setStyle, remove, errorHandle, hasOwnProperty } from './index';
|
||||
|
||||
export default function component(art, parent, target, getOption, callback, title) {
|
||||
const option = typeof getOption === 'function' ? getOption(art) : getOption;
|
||||
if (!option.disable) {
|
||||
const name = option.name || `${title}${parent.id}`;
|
||||
errorHandle(!hasOwnProperty(parent, name), `Cannot create a component that already has the same name: ${title} -> ${name}`);
|
||||
const $element = document.createElement('div');
|
||||
$element.classList.value = `art-${title} art-${title}-${name}`;
|
||||
|
||||
|
||||
Reference in new issue
Block a user