feat: Add "Open in Browser" context menu item to artist and album page (#1096)

This commit is contained in:
Changjian Gao 2021-12-20 18:57:45 +08:00 committed by GitHub
parent 16c3613267
commit 5c6eaa8fda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 2 deletions

View File

@ -179,6 +179,7 @@ export default {
addToPlaylist: 'Add to playlist',
searchInPlaylist: 'Search in playlist',
copyUrl: 'Copy URL',
openInBrowser: 'Open in Browser',
allPlaylists: 'All Playlists',
minePlaylists: 'My Playlists',
likedPlaylists: 'Liked Playlists',

View File

@ -180,6 +180,7 @@ export default {
addToPlaylist: '添加到歌单',
searchInPlaylist: '歌单内搜索',
copyUrl: '复制链接',
openInBrowser: '在浏览器中打开',
allPlaylists: '全部歌单',
minePlaylists: '创建的歌单',
likedPlaylists: '收藏的歌单',

View File

@ -176,6 +176,7 @@ export default {
removeFromLibrary: '從音樂庫刪除',
addToPlaylist: '新增至歌單',
searchInPlaylist: '歌單內搜尋',
openInBrowser: '在瀏覽器中打開',
copyUrl: '複製連結',
allPlaylists: '全部歌單',
minePlaylists: '我建立的歌單',

View File

@ -137,6 +137,9 @@
<div class="item" @click="copyUrl(album.id)">{{
$t('contextMenu.copyUrl')
}}</div>
<div class="item" @click="openInBrowser(album.id)">{{
$t('contextMenu.openInBrowser')
}}</div>
</ContextMenu>
</div>
</template>
@ -305,7 +308,7 @@ export default {
},
copyUrl(id) {
let showToast = this.showToast;
this.$copyText('https://music.163.com/#/album?id=' + id)
this.$copyText(`https://music.163.com/#/album?id=${id}`)
.then(function () {
showToast(locale.t('toast.copied'));
})
@ -313,6 +316,10 @@ export default {
showToast(`${locale.t('toast.copyFailed')}${error}`);
});
},
openInBrowser(id) {
const url = `https://music.163.com/#/album?id=${id}`;
window.open(url);
},
},
};
</script>

View File

@ -169,6 +169,9 @@
<div class="item" @click="copyUrl(artist.id)">{{
$t('contextMenu.copyUrl')
}}</div>
<div class="item" @click="openInBrowser(artist.id)">{{
$t('contextMenu.openInBrowser')
}}</div>
</ContextMenu>
</div>
</template>
@ -339,7 +342,7 @@ export default {
},
copyUrl(id) {
let showToast = this.showToast;
this.$copyText('https://music.163.com/#/artist?id=' + id)
this.$copyText(`https://music.163.com/#/artist?id=${id}`)
.then(function () {
showToast(locale.t('toast.copied'));
})
@ -347,6 +350,10 @@ export default {
showToast(`${locale.t('toast.copyFailed')}${error}`);
});
},
openInBrowser(id) {
const url = `https://music.163.com/#/artist?id=${id}`;
window.open(url);
},
},
};
</script>