在文章里添加音乐播放器

Posted on 2023-12-04  429 Views


教程

在文章首页加入如下代码(使用APlayer)

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css">
<script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script>
<div id="aplayer01"></div>
<script type="text/javascript">
    const ap = new APlayer({
        container: document.getElementById('aplayer01'),
        audio: [{
            name: '遠い日に想いを馳せて',
            artist: 'Laplacian',
            url: '你的音乐 url(https://xxx.mp3)',
            cover: '你的音乐封面 ulr(https:/xxx.png'
        }]
    });
</script>