mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 01:21:20 -08:00
bugfix
This commit is contained in:
1 parent
c25038b74c
commit
ae548e93c8
18 files changed
+176
-101
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import validElement from './validElement';
|
||||
import validStringEmpty from './validStringEmpty';
|
||||
import validElementMap from './validElementMap';
|
||||
|
||||
export default {
|
||||
container: {
|
||||
@@ -63,8 +64,10 @@ export default {
|
||||
url: 'string'
|
||||
}
|
||||
},
|
||||
loading: validElement,
|
||||
play: validElement,
|
||||
replace: {
|
||||
type: 'object',
|
||||
validator: validElementMap
|
||||
},
|
||||
theme: 'string',
|
||||
hotkey: 'boolean',
|
||||
pip: 'boolean',
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { ArtPlayerError } from '../utils';
|
||||
|
||||
export default function validElementMap(paths, value) {
|
||||
return Object.keys(value).every(key => {
|
||||
const mapValue = value[key];
|
||||
const mapType = typeof mapValue;
|
||||
if (mapValue instanceof Element || mapType === 'string') {
|
||||
return true;
|
||||
}
|
||||
throw new ArtPlayerError(`${paths.join('.')} require 'string' or 'Element' type, but got '${mapType}'`);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user