新增显示歌词翻译设置,默认开启

This commit is contained in:
lyswhut
2020-08-23 15:45:08 +08:00
parent c15895ab45
commit 669c1fe490
20 changed files with 137 additions and 44 deletions
+5 -2
View File
@@ -4,7 +4,7 @@
transition(enter-active-class="animated-fast fadeIn" leave-active-class="animated-fast fadeOut")
.control-bar(v-show="!lrcConfig.isLock")
core-control-bar(:lrcConfig="lrcConfig" :themes="themeList")
core-lyric(:lrcConfig="lrcConfig")
core-lyric(:lrcConfig="lrcConfig" :isShowLyricTransition="isShowLyricTransition")
div.resize-left(@mousedown.self="handleMouseDown('left', $event)")
div.resize-top(@mousedown.self="handleMouseDown('top', $event)")
div.resize-right(@mousedown.self="handleMouseDown('right', $event)")
@@ -44,6 +44,7 @@ export default {
isZoomActiveLrc: true,
},
},
isShowLyricTransition: true,
themeList: [
{
id: 0,
@@ -117,8 +118,10 @@ export default {
document.removeEventListener('mouseup', this.handleMouseUp)
},
methods: {
handleUpdateConfig({ config, languageId }) {
handleUpdateConfig({ config, languageId, isShowLyricTransition }) {
console.log(isShowLyricTransition)
this.lrcConfig = config
this.isShowLyricTransition = isShowLyricTransition
if (this.$i18n.locale !== languageId && languageId != null) this.$i18n.locale = languageId
},
handleMouseDown(origin, event) {
+22 -2
View File
@@ -27,6 +27,10 @@ export default {
}
},
},
isShowLyricTransition: {
type: Boolean,
default: true,
},
},
data() {
return {
@@ -58,6 +62,10 @@ export default {
lyricLines: [],
isSetedLines: false,
isPlay: false,
lyrics: {
lyric: '',
tlyric: '',
},
}
},
computed: {
@@ -112,6 +120,11 @@ export default {
},
immediate: true,
},
isShowLyricTransition(n) {
console.log(n)
this.setLyric()
rendererSend(NAMES.winLyric.get_lyric_info, 'status')
},
},
created() {
rendererOn(NAMES.winLyric.set_lyric_info, (event, data) => this.handleSetInfo(data))
@@ -144,7 +157,9 @@ export default {
// console.log(type, data)
switch (type) {
case 'lyric':
window.lrc.setLyric(data)
this.lyrics.lyric = data.lrc
this.lyrics.tlyric = data.tlrc
this.setLyric()
break
case 'play':
this.isPlay = true
@@ -156,7 +171,9 @@ export default {
break
case 'info':
// console.log('info', data)
window.lrc.setLyric(data.lyric)
this.lyrics.lyric = data.lyric
this.lyrics.tlyric = data.tlyric
this.setLyric()
this.$nextTick(() => {
this.lyric.line = data.line
rendererSend(NAMES.winLyric.get_lyric_info, 'status')
@@ -261,6 +278,9 @@ export default {
close() {
rendererSend(NAMES.winLyric.close)
},
setLyric() {
window.lrc.setLyric((this.isShowLyricTransition && this.lyrics.tlyric ? this.lyrics.tlyric + '\n' : '') + this.lyrics.lyric)
},
},
}
</script>