组件添加add方法

This commit is contained in:
Harvey committed 2019-11-22 16:34:31 +08:00
1 parent 1d859e2049
commit 2fcd44e8e7
28 files changed
+303 -328

No files matched your search

@@ -0,0 +1,32 @@
import { append, tooltip, setStyle } from '../utils';
export default function fullscreen(option) {
return art => ({
...option,
mounted: $control => {
const {
events: { proxy },
icons,
i18n,
player,
} = art;
const $fullscreen = append($control, icons.fullscreen);
tooltip($fullscreen, i18n.get('Fullscreen'));
proxy($control, 'click', () => {
player.fullscreenToggle = true;
});
art.on('fullscreen:enabled', () => {
setStyle($fullscreen, 'opacity', '0.8');
tooltip($fullscreen, i18n.get('Exit fullscreen'));
});
art.on('fullscreen:exit', () => {
setStyle($fullscreen, 'opacity', '1');
tooltip($fullscreen, i18n.get('Fullscreen'));
});
},
});
}