mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 14:41:20 -08:00
优化类型检测
This commit is contained in:
1 parent
3e609bb153
commit
9760d6268f
6 files changed
+168
-342
No files matched your search
@@ -132,8 +132,8 @@ export default class Artplayer extends Emitter {
|
||||
networkMonitor: false,
|
||||
layers: [],
|
||||
contextmenu: [],
|
||||
quality: [],
|
||||
controls: [],
|
||||
quality: [],
|
||||
highlight: [],
|
||||
plugins: [],
|
||||
whitelist: [],
|
||||
|
||||
@@ -7,6 +7,17 @@ function validElement(value, type, paths) {
|
||||
);
|
||||
}
|
||||
|
||||
const component = {
|
||||
html: validElement,
|
||||
disable: 'boolean|undefined',
|
||||
name: 'string|undefined',
|
||||
index: 'number|undefined',
|
||||
style: 'object|undefined',
|
||||
click: 'function|undefined',
|
||||
mounted: 'function|undefined',
|
||||
tooltip: 'string|undefined',
|
||||
};
|
||||
|
||||
export default {
|
||||
container: validElement,
|
||||
url: 'string',
|
||||
@@ -40,28 +51,18 @@ export default {
|
||||
networkMonitor: 'boolean',
|
||||
plugins: ['function'],
|
||||
whitelist: ['string|function|regexp'],
|
||||
layers: [
|
||||
layers: [component],
|
||||
contextmenu: [component],
|
||||
controls: [
|
||||
{
|
||||
disable: 'boolean|undefined',
|
||||
name: 'string|undefined',
|
||||
index: 'number|undefined',
|
||||
html: validElement,
|
||||
style: 'object|undefined',
|
||||
click: 'function|undefined',
|
||||
mounted: 'function|undefined',
|
||||
tooltip: 'string|undefined',
|
||||
},
|
||||
],
|
||||
contextmenu: [
|
||||
{
|
||||
disable: 'boolean|undefined',
|
||||
name: 'string|undefined',
|
||||
index: 'number|undefined',
|
||||
html: validElement,
|
||||
style: 'object|undefined',
|
||||
click: 'function|undefined',
|
||||
mounted: 'function|undefined',
|
||||
tooltip: 'string|undefined',
|
||||
...component,
|
||||
position: (value, type, paths) => {
|
||||
const position = ['top', 'left', 'right'];
|
||||
return errorHandle(
|
||||
position.includes(value),
|
||||
`${paths.join('.')} only accept ${position.toString()} as parameters, but got ${type}`,
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
quality: [
|
||||
@@ -71,25 +72,6 @@ export default {
|
||||
url: 'string',
|
||||
},
|
||||
],
|
||||
controls: [
|
||||
{
|
||||
disable: 'boolean|undefined',
|
||||
name: 'string|undefined',
|
||||
index: 'number|undefined',
|
||||
html: validElement,
|
||||
style: 'object|undefined',
|
||||
click: 'function|undefined',
|
||||
mounted: 'function|undefined',
|
||||
tooltip: 'string|undefined',
|
||||
position: (value, type, paths) => {
|
||||
const position = ['top', 'left', 'right'];
|
||||
return errorHandle(
|
||||
position.includes(value),
|
||||
`${paths.join('.')} only accept ${position.toString()} as parameters`,
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
highlight: [
|
||||
{
|
||||
time: 'number',
|
||||
|
||||
Reference in new issue
Block a user