格式化

This commit is contained in:
Harvey Zack committed 2018-11-21 19:45:44 +08:00
1 parent 0454f785be
commit 203ad0d3a0
75 files changed
+3120 -2904

No files matched your search

+103 -103
View File
@@ -2,109 +2,109 @@ import validElement from './validElement';
import validStringEmpty from './validStringEmpty';
export default {
container: {
validator: validElement,
required: true
},
url: {
type: 'string',
required: true,
validator: validStringEmpty
},
poster: 'string',
title: 'string',
type: {
type: 'string'
},
mimeCodec: 'string',
theme: 'string',
volume: 'number',
autoplay: 'boolean',
autoSize: 'boolean',
loop: 'boolean',
playbackRate: 'boolean',
aspectRatio: 'boolean',
screenshot: 'boolean',
setting: 'boolean',
hotkey: 'boolean',
pip: 'boolean',
mutex: 'boolean',
fullscreen: 'boolean',
fullscreenWeb: 'boolean',
layers: {
type: 'array',
child: {
disable: 'boolean',
type: 'object|function',
name: 'string',
index: 'number',
html: validElement,
style: 'object',
click: 'function'
}
},
contextmenu: {
type: 'array',
child: {
disable: 'boolean',
type: 'object|function',
name: 'string',
index: 'number',
html: validElement,
style: 'object',
click: 'function'
}
},
quality: {
type: 'array',
child: {
default: 'boolean',
name: 'string',
url: 'string'
}
},
controls: {
type: 'array',
child: {
type: 'object',
option: {
container: {
validator: validElement,
required: true,
},
url: {
type: 'string',
required: true,
validator: validStringEmpty,
},
poster: 'string',
title: 'string',
type: {
type: 'string',
},
mimeCodec: 'string',
theme: 'string',
volume: 'number',
autoplay: 'boolean',
autoSize: 'boolean',
loop: 'boolean',
playbackRate: 'boolean',
aspectRatio: 'boolean',
screenshot: 'boolean',
setting: 'boolean',
hotkey: 'boolean',
pip: 'boolean',
mutex: 'boolean',
fullscreen: 'boolean',
fullscreenWeb: 'boolean',
layers: {
type: 'array',
child: {
disable: 'boolean',
type: 'object|function',
name: 'string',
index: 'number',
html: validElement,
style: 'object',
click: 'function',
},
},
contextmenu: {
type: 'array',
child: {
disable: 'boolean',
type: 'object|function',
name: 'string',
index: 'number',
html: validElement,
style: 'object',
click: 'function',
},
},
quality: {
type: 'array',
child: {
default: 'boolean',
name: 'string',
url: 'string',
},
},
controls: {
type: 'array',
child: {
type: 'object',
option: {
type: 'object',
child: {
disable: 'boolean',
name: 'string',
index: 'number',
position: 'string',
},
},
},
},
highlight: {
type: 'array',
child: {
type: 'object',
time: 'number',
text: 'string',
},
},
thumbnails: {
type: 'object',
child: {
disable: 'boolean',
name: 'string',
index: 'number',
position: 'string'
}
}
}
},
highlight: {
type: 'array',
child: {
type: 'object',
time: 'number',
text: 'string'
}
},
thumbnails: {
type: 'object',
child: {
type: 'object',
url: 'string',
number: 'number',
width: 'number',
height: 'number',
column: 'number'
}
},
subtitle: {
type: 'object',
child: {
type: 'object',
url: 'string',
style: 'object'
}
},
moreVideoAttr: 'object',
lang: 'string'
type: 'object',
url: 'string',
number: 'number',
width: 'number',
height: 'number',
column: 'number',
},
},
subtitle: {
type: 'object',
child: {
type: 'object',
url: 'string',
style: 'object',
},
},
moreVideoAttr: 'object',
lang: 'string',
};
+10 -10
View File
@@ -1,17 +1,17 @@
import { ArtPlayerError } from '../utils';
export default function validElement(paths, value, type) {
if (type === 'string') {
if (value.trim() === '') {
throw new ArtPlayerError(`${paths.join('.')} can not be empty`);
} else {
return true;
if (type === 'string') {
if (value.trim() === '') {
throw new ArtPlayerError(`${paths.join('.')} can not be empty`);
} else {
return true;
}
}
}
if (value instanceof Element) {
return true;
}
if (value instanceof Element) {
return true;
}
throw new ArtPlayerError(`${paths.join('.')} require 'string' or 'Element' type, but got '${type}'`);
throw new ArtPlayerError(`${paths.join('.')} require 'string' or 'Element' type, but got '${type}'`);
}
@@ -1,13 +1,13 @@
import { ArtPlayerError } from '../utils';
export default function validStringEmpty(paths, value, type) {
if (type !== 'string') {
throw new ArtPlayerError(`${paths.join('.')} required 'string' type.`);
}
if (type !== 'string') {
throw new ArtPlayerError(`${paths.join('.')} required 'string' type.`);
}
if (value.trim() === '') {
throw new ArtPlayerError(`${paths.join('.')} can not be empty`);
}
if (value.trim() === '') {
throw new ArtPlayerError(`${paths.join('.')} can not be empty`);
}
return true;
return true;
}