我正在尝试迭代一组Audio对象(包含3个字符串)并将每次迭代中的音频传递给子组件.
app.component.ts
ngOnInit(){
this.audios = new Array<SoundBoardAudio>();
this.audios.push(new SoundBoardAudio('Western','La canción del Sheriff.','western.mp3'));
this.audios.push(new SoundBoardAudio('Olvidelo Amigo','Busquese otro tonto amigo.','olvidelo_amigo.mp3'));
}
Run Code Online (Sandbox Code Playgroud)
app.component.html
<div class="container">
<app-soundcard *ngFor="let audio of audios" soundBoardAudio=audio></app-soundcard>
</div>
Run Code Online (Sandbox Code Playgroud)
soundboard.component.ts
export class SoundcardComponent implements OnInit {
audio:any;
constructor() {}
@Input() soundBoardAudio;
ngOnInit() {
console.log(this.soundBoardAudio);
let audioSrc = 'assets/audio/'+this.soundBoardAudio.filename;
this.audio = new Audio(audioSrc);
}
...
Run Code Online (Sandbox Code Playgroud)
soundboard.component.html
<div class="card" >
<div class="card-block">
<h2 class="card-title">{{soundBoardAudio.name}}</h2>
<p>{{soundBoardAudio.desc}}
</div>
...
Run Code Online (Sandbox Code Playgroud)
但是当我尝试从子组件中读取音频时,我得到一个未定义的值.如果我只传递一个字符串而不是一个对象,它可以正常工作.
我使用以下HTML代码制作了一个包含3个按钮(btn-navbar)的页脚.折叠导航栏时,我可以正确地进行操作,但按钮显示在同一行中,而不是像<li>
元素一样显示在一起.
<!-- Fixed navbar bottom -->
<div class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container-fluid">
<div class="navbar-collapse collapse" id="navbar-footer">
<ul class="nav navbar-nav navbar-right">
<button type="button" class="btn btn-warning navbar-btn"><span class="glyphicon glyphicon-check"></span> Verificar</button>
<button type="button" class="btn btn-danger navbar-btn"><span class="glyphicon glyphicon-remove"></span> Cancelar</button>
<button type="button" class="btn btn-success navbar-btn"><span class="glyphicon glyphicon-ok"></span> Aceptar</button>
</ul>
</div><!--/.nav-collapse -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-footer">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
它显示这样......
而且我希望它像这样展示......
提前致谢.
现在我必须在我想要服务的目录中才能运行“jekyll serve”。有什么办法可以在另一个目录中指向我想要提供服务的目录吗?就像是:
jekyll serve --dir=anotherFolder
我正在开发一个带有选项卡导航的 Ionic 2 应用程序,如 Ionic 文档中所述:http://ionicframework.com/docs/components/#tabs-icon-text
选项卡栏有 5 个选项卡,我想突出中央选项卡,使其呈圆形,如下图所示。
我没有看到框架提供任何标准方法来做到这一点,使用 CSS 实现这一点的最简单方法是什么?