Warning: is_readable(): open_basedir restriction in effect. File(/gitinfo/info.json) is not within the allowed path(s): (/www/wwwroot/wiki.guguwo.top/:/tmp/) in /www/wwwroot/wiki.guguwo.top/includes/utils/GitInfo.php on line 177
模板:APlayer/doc - 咕咕窝wiki

模板:APlayer/doc

来自咕咕窝wiki
卡介菌讨论 | 贡献2025年3月16日 (日) 04:46的版本 (创建页面,内容为“你可以在这调用aplayer插入音频 {{APlayer | lrc = 3 // 歌词类型(可选) | audios = * https://example.com/song1.mp3 * https://example.com/song2.mp3 | titles = * 歌曲1 * 歌曲2 | artists = * 艺术家1 * 艺术家2 }}”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

你可以在这调用aplayer插入音频

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.css"> <script src="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/meting@2.0.1/dist/Meting.min.js"></script>

<style> /* 移动端适配 */ .aplayer {

   max-width: 100%;
   margin: 10px auto;
   font-family: -apple-system, "PingFang SC", "Microsoft YaHei";

}

/* 小屏幕优化 */ @media screen and (max-width: 768px) {

   .aplayer-info {
       padding: 8px;
   }
   .aplayer-author {
       font-size: 12px;
   }
   .aplayer-controller .aplayer-bar {
       margin: 0 5px;
   }

} </style>

<script> (function() {

   // 收集歌曲数据
   var songs = [];
   var box = document.querySelector('.aplayer-box');
   
   // 处理多首歌曲参数
   for(var i = 1; ; i++) {
       var prefix = "song" + i;
       var data = {
           title: box.dataset[prefix + 'title'],
           author: box.dataset[prefix + 'author'],
           url: box.dataset[prefix + 'url'],
           pic: box.dataset[prefix + 'pic']
       };
       
       if(!data.title) break;
       songs.push(data);
   }
   // 初始化播放器
   var ap = new APlayer({
       container: box,
       audio: songs,
       fixed: false,
       listFolded: true,
       lrcType: 0,
       theme: '#2980b9'
   });

})(); </script>