mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 06:31:20 -08:00
分离template
This commit is contained in:
1 parent
e96146b19f
commit
3fb41eedf7
39 files changed
+277
-256
No files matched your search
@@ -15,14 +15,14 @@ export default class Subtitle {
|
||||
const {
|
||||
events: { proxy },
|
||||
option: { subtitle },
|
||||
refs: { $video, $subtitle },
|
||||
template: { $video, $subtitle },
|
||||
} = this.art;
|
||||
setStyles($subtitle, subtitle.style || {});
|
||||
const $track = document.createElement('track');
|
||||
$track.default = true;
|
||||
$track.kind = 'metadata';
|
||||
$video.appendChild($track);
|
||||
this.art.refs.$track = $track;
|
||||
this.art.template.$track = $track;
|
||||
this.load(subtitle.url).then(url => {
|
||||
$track.src = url;
|
||||
this.art.emit('subtitle:load', url);
|
||||
@@ -71,7 +71,7 @@ export default class Subtitle {
|
||||
|
||||
show() {
|
||||
const {
|
||||
refs: { $subtitle },
|
||||
template: { $subtitle },
|
||||
i18n,
|
||||
notice,
|
||||
} = this.art;
|
||||
@@ -83,7 +83,7 @@ export default class Subtitle {
|
||||
|
||||
hide() {
|
||||
const {
|
||||
refs: { $subtitle },
|
||||
template: { $subtitle },
|
||||
i18n,
|
||||
notice,
|
||||
} = this.art;
|
||||
@@ -102,7 +102,7 @@ export default class Subtitle {
|
||||
}
|
||||
|
||||
switch(url) {
|
||||
const { $track } = this.art.refs;
|
||||
const { $track } = this.art.template;
|
||||
errorHandle($track, 'You need to initialize the subtitle option first.');
|
||||
this.load(url).then(url => {
|
||||
$track.src = url;
|
||||
|
||||
Reference in new issue
Block a user