mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 08:51:20 -08:00
简化player接口
This commit is contained in:
1 parent
1b69b28ba1
commit
52b6693da2
41 files changed
+624
-690
No files matched your search
@@ -1,23 +1,20 @@
|
||||
import { errorHandle } from '../utils';
|
||||
|
||||
export default function flipMix(art, player) {
|
||||
Object.defineProperty(player, 'flipState', {
|
||||
get: () => art.template.$player.dataset.flip,
|
||||
});
|
||||
|
||||
Object.defineProperty(player, 'flip', {
|
||||
value: flip => {
|
||||
const flipList = ['normal', 'horizontal', 'vertical'];
|
||||
errorHandle(flipList.includes(flip), `'flip' only accept ${flipList.toString()} as parameters`);
|
||||
art.template.$player.dataset.flip = flip;
|
||||
art.emit('flipChange', flip);
|
||||
get() {
|
||||
return art.template.$player.dataset.flip;
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(player, 'flipRemove', {
|
||||
value: () => {
|
||||
delete art.template.$player.dataset.flip;
|
||||
art.emit('flipRemove');
|
||||
set(flip) {
|
||||
if (flip) {
|
||||
const flipList = ['normal', 'horizontal', 'vertical'];
|
||||
errorHandle(flipList.includes(flip), `'flip' only accept ${flipList.toString()} as parameters`);
|
||||
art.template.$player.dataset.flip = flip;
|
||||
art.emit('flipChange', flip);
|
||||
} else {
|
||||
delete art.template.$player.dataset.flip;
|
||||
art.emit('flipRemove');
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user