1个不稳定版本
0.1.0 | 2020年10月22日 |
---|
#1285 in WebAssembly
4KB
59 行
Yew的APlayer
如何使用
- 它只做wasm绑定,所以先加载cdn
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/aplayer/1.10.1/APlayer.min.css">
- 通过
<APlayer/>
容易使用
use yew_aplayer::{APlayer, APlayerAudio};
let songs = vec![
APlayerAudio::new(
"前前前世",
"RADWIMPS",
"https://cn-south-17-aplayer-46154810.oss.dogecdn.com/yourname.mp3",
"https://cn-south-17-aplayer-46154810.oss.dogecdn.com/yourname.jpg",
Some("https://cn-south-17-aplayer-46154810.oss.dogecdn.com/yourname.lrc"),
),
APlayerAudio::new(
"回レ!雪月花",
"小倉唯",
"https://cn-east-17-aplayer-35525609.oss.dogecdn.com/snowmoonflowers.mp3",
"https://cn-east-17-aplayer-35525609.oss.dogecdn.com/snowmoonflowers.jpg",
Some("https://cn-east-17-aplayer-35525609.oss.dogecdn.com/snowmoonflowers.lrc"),
),
];
html! {
<APlayer audios=songs/>
}
待办事项
- 当第一个组件加载时自动导入css cdn
依赖项
~12MB
~229K SLoC